Skip to content

Commit 42754a5

Browse files
authored
Properly get PR number for merge group (#1077)
Run https://github.com/mmtk/mmtk-core/actions/runs/7649653943/job/20844445119 failed, as we use `${{ github.event.pull_request.number }}` to get the pull request number and it does not work for the `merge_group` trigger. This PR gets pull request number using a third-party action which properly deals with both `pull_request` and `merge_group`.
1 parent de454f5 commit 42754a5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/minimal-tests-bindings.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,26 @@ jobs:
1818
# This step allows 2mins before we check comments for binding repos/refs.
1919
grace-period:
2020
runs-on: ubuntu-latest
21+
outputs:
22+
pr-number: ${{ steps.set-output.outputs.pr-number }}
2123
steps:
24+
# This workflow runs for both merge_group and pull_request
25+
# We need a way to get the pull request number that works for both cases.
26+
# The action can do that.
27+
- id: get-pr-number
28+
uses: mgaitan/gha-get-pr-number@main
29+
# This job also outputs the PR number
30+
- id: set-output
31+
run: echo "pr-number=${{ steps.get-pr-number.outputs.number }}" >> $GITHUB_OUTPUT
32+
# Sleep for 2 mins
2233
- run: sleep 120
2334

2435
# Figure out binding PRs.
2536
binding-refs:
2637
needs: grace-period
2738
uses: ./.github/workflows/pr-binding-refs.yml
2839
with:
29-
pull_request: ${{ github.event.pull_request.number }}
40+
pull_request: ${{ needs.grace-period.outputs.pr-number }}
3041

3142
minimal-tests-openjdk:
3243
needs: binding-refs

0 commit comments

Comments
 (0)