Fail the job if docker tag matches MAJOR.MINOR.PATCH naming

This commit is contained in:
Andrei Borza
2025-02-25 12:05:58 +01:00
parent ef8b952c7d
commit c153c71551
+11
View File
@@ -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