Skip to content

Commit 934b5e8

Browse files
committed
Fail the job if docker tag matches MAJOR.MINOR.PATCH naming
1 parent ef8b952 commit 934b5e8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
name: Build and Test
22

33
on:
4+
push:
5+
branches:
6+
- release/**
47
pull_request:
58
types:
69
- opened
710
- synchronize
811
- reopened
912

10-
env:
11-
# Variables defined in the repository
12-
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
13-
# For master, we have an environment variable that selects the action-release project
14-
# instead of action-release-prs
15-
# For other branches: https://sentry-ecosystem.sentry.io/releases/?project=4505075304693760
16-
# For master branch: https://sentry-ecosystem.sentry.io/releases/?project=6576594
17-
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
18-
1913
jobs:
2014
docker-build:
2115
name: Build & publish Docker images
@@ -39,6 +33,14 @@ jobs:
3933
run: |
4034
TAG=$(yq '... | select(has("uses") and .uses | test("docker://ghcr.io/getsentry/action-release-image:.*")) | .uses' action.yml | awk -F':' '{print $3}')
4135
echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV
36+
37+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
38+
if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
39+
echo "Error: DOCKER_TAG ($TAG) is not allowed to match `MAJOR.MINOR.PATCH` inside a pull request."
40+
echo "Please rename the docker tag in `action.yml` and try again."
41+
exit 1
42+
fi
43+
fi
4244
4345
- name: Set up QEMU
4446
uses: docker/setup-qemu-action@v3

0 commit comments

Comments
 (0)