From c153c71551d5f1d0536886d6cca8bf6770475953 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 25 Feb 2025 11:54:03 +0100 Subject: [PATCH] Fail the job if docker tag matches MAJOR.MINOR.PATCH naming --- .github/workflows/build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 509a91d..0b3a3ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build and Test on: + push: + branches: + - release/** pull_request: types: - opened @@ -39,6 +42,14 @@ jobs: run: | TAG=$(yq '... | select(has("uses") and .uses | test("docker://ghcr.io/getsentry/action-release-image:.*")) | .uses' action.yml | awk -F':' '{print $3}') echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Error: DOCKER_TAG ($TAG) is not allowed to match `MAJOR.MINOR.PATCH` inside a pull request." + echo "Please rename the docker tag in `action.yml` and try again." + exit 1 + fi + fi - name: Set up QEMU uses: docker/setup-qemu-action@v3