Skip to content

Commit 75adc56

Browse files
committed
Use repository_dispatch
1 parent e685c5a commit 75adc56

2 files changed

Lines changed: 14 additions & 26 deletions

File tree

.github/workflows/create-release-branch.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ jobs:
5959
run: |
6060
git checkout -b "${{ steps.define-branch.outputs.branch }}"
6161
git push -u origin "${{ steps.define-branch.outputs.branch }}"
62+
63+
- name: Dispatch repository event to pin system tests
64+
if: steps.check-branch.outputs.creating_new_branch == 'true'
65+
uses: peter-evans/repository-dispatch@v4
66+
with:
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
event-type: pin-system-tests
69+
client-payload: '{"release-branch-name": "${{ steps.define-branch.outputs.branch }}"}'

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ on:
77
description: 'The minor release branch name (e.g. release/v1.54.x)'
88
required: true
99
type: string
10-
workflow_run:
11-
workflows: [Create Release Branch]
12-
types:
13-
- completed
10+
repository_dispatch:
11+
types: [pin-system-tests]
1412

1513
jobs:
1614
# TODO: Remove this job after confirming the workflow succeeds for release branches
@@ -24,7 +22,6 @@ jobs:
2422
2523
pin-system-tests:
2624
name: "Pin system tests"
27-
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
2825
runs-on: ubuntu-latest
2926
permissions:
3027
contents: write
@@ -36,33 +33,16 @@ jobs:
3633
scope: DataDog/dd-trace-java
3734
policy: self.pin-system-tests.create-pr
3835

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-
5736
- name: Define base release branch
5837
id: define-base-branch
5938
run: |
6039
if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then
6140
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 }}"
6441
else
65-
echo "ERROR: Unable to determine base branch."
42+
BASE_BRANCH="${{ github.event.client_payload.release-branch-name }}"
43+
fi
44+
if [[ -z "$BASE_BRANCH" ]]; then
45+
echo "ERROR: Could not determine release branch"
6646
exit 1
6747
fi
6848
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)