From 1686911c1af120622424fa2bf74abab42b349e66 Mon Sep 17 00:00:00 2001 From: Samarjeet Date: Wed, 10 May 2023 17:15:34 +0530 Subject: [PATCH] CI Add validation for branch input (#557) --- .github/workflows/test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fca7417..40951b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,15 @@ jobs: node: [14] runs-on: ${{ matrix.os }} steps: + - uses: actions-ecosystem/action-regex-match@v2 + id: regex-match + if: ${{ github.event_name == 'workflow_dispatch' }} + with: + text: ${{ github.event.inputs.branch }} + regex: '^[a-zA-Z0-9_/\-]+$' + - name: Break on invalid branch name + run: exit 1 + if: ${{ github.event_name == 'workflow_dispatch' && steps.regex-match.outputs && steps.regex-match.outputs.match == '' }} - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: