Skip to content

Commit 99c60bd

Browse files
committed
Change pin-system-tests workflow trigger to release tag
1 parent 4914aae commit 99c60bd

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/pin-system-tests.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
description: 'The minor release branch name (e.g. release/v1.54.x)'
88
required: true
99
type: string
10-
# run workflow when any branch is created
10+
# run workflow when any branch or tag is created
1111
create:
1212

1313
jobs:
14-
# TODO: Remove this job after confirming the github.ref when a release branch is created
14+
# TODO: Remove this job after confirming the workflow succeeds for release branches
1515
print-github-ref:
1616
name: "Print full github.ref"
1717
runs-on: ubuntu-latest
@@ -22,7 +22,7 @@ jobs:
2222
2323
pin-system-tests:
2424
name: "Pin system tests"
25-
if: github.event_name != 'create' || contains(github.ref, 'release/v')
25+
if: github.event_name != 'create' || (contains(github.ref, 'tags/v') && endsWith(github.ref, '.0'))
2626
runs-on: ubuntu-latest
2727
permissions:
2828
contents: write
@@ -40,7 +40,14 @@ jobs:
4040
if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then
4141
BASE_BRANCH=${{ github.event.inputs.release-branch-name }}
4242
else
43-
BASE_BRANCH=${GITHUB_REF#refs/heads/}
43+
# Convert tag (e.g. v1.54.0) to release branch name (e.g. release/v1.54.x)
44+
TAG=${GITHUB_REF#refs/tags/}
45+
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
46+
BASE_BRANCH="release/${TAG%.0}.x"
47+
else
48+
echo "ERROR: Tag $TAG is not in the expected format: vX.Y.0"
49+
exit 1
50+
fi
4451
fi
4552
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
4653

0 commit comments

Comments
 (0)