From 6f28ed91c3b2102e6ce8b411b7703bd4cb17739d Mon Sep 17 00:00:00 2001 From: Samarjeet Date: Wed, 10 May 2023 17:16:31 +0530 Subject: [PATCH] CI Add validation for branch input (#516) --- .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: