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 or tag is created
11- create :
10+ workflow_run :
11+ workflows : [Create Release Branch]
12+ types :
13+ - completed
1214
1315jobs :
1416 # TODO: Remove this job after confirming the workflow succeeds for release branches
2224
2325 pin-system-tests :
2426 name : " Pin system tests"
25- if : github.event_name != 'create ' || (contains( github.ref, 'tags/v') && endsWith(github.ref, '.0'))
27+ if : github.event_name == 'workflow_dispatch ' || github.event.workflow_run.conclusion == 'success'
2628 runs-on : ubuntu-latest
2729 permissions :
2830 contents : write
@@ -34,20 +36,34 @@ jobs:
3436 scope : DataDog/dd-trace-java
3537 policy : self.pin-system-tests.create-pr
3638
39+ - name : Checkout repository for tag lookup
40+ if : github.event_name == 'workflow_run'
41+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
42+ with :
43+ fetch-depth : 0 # fetch entire history, including tags
44+
45+ - name : Get release branch name from tag
46+ if : github.event_name == 'workflow_run'
47+ id : get-release-branch
48+ run : |
49+ HEAD_SHA="${{ github.event.workflow_run.head_sha }}"
50+ TAG=$(git tag --points-at "$HEAD_SHA" | grep -E '^v[0-9]+\.[0-9]+\.0$' | head -n 1)
51+ if [[ -z "$TAG" ]]; then
52+ echo "ERROR: Could not find tag that matches pattern 'vX.Y.0' and points at commit $HEAD_SHA"
53+ exit 1
54+ fi
55+ echo "branch=release/${TAG%.0}.x" >> $GITHUB_OUTPUT
56+
3757 - name : Define base release branch
3858 id : define-base-branch
3959 run : |
4060 if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then
4161 BASE_BRANCH=${{ github.event.inputs.release-branch-name }}
62+ elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then
63+ BASE_BRANCH="${{ steps.get-release-branch.outputs.branch }}"
4264 else
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
65+ echo "ERROR: Unable to determine base branch."
66+ exit 1
5167 fi
5268 echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
5369
0 commit comments