From 225bee930535ae1638a1c77fa4e01103138374bc Mon Sep 17 00:00:00 2001 From: Douglas Egiemeh Date: Wed, 4 Dec 2024 16:13:31 +0100 Subject: [PATCH] chore(uikit preview releae): validate preview branch name in workflow (#3000) --- .github/workflows/preview-release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index 4659cb6bc4..759c8799c8 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -30,6 +30,14 @@ jobs: # https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8 token: ${{ steps.generate_github_token.outputs.token }} + - name: Validate branch name + run: | + BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}" | tr '/' '-') + if [[ ! "$BRANCH_NAME" =~ ^preview/[a-zA-Z0-9_-]+$ ]]; then + echo "Ignoring PR because of the branch name. Exiting workflow." + exit 1 + fi + - name: Setup Node (uses version in .nvmrc) uses: actions/setup-node@v4 with: