Skip to content

Commit 9bc05b1

Browse files
Checkout correct commit on pull_request in CI
By default, the `pull_request` event has a `GITHUB_SHA` env variable set to the "last merge commit on the GITHUB_REF branch" (see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request). But we want to check out the latest commit on the branch whether or not it is a merge commit. This commit changes the CI actions to do just that.
1 parent 2073200 commit 9bc05b1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/bench.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ jobs:
5757

5858
steps:
5959
- uses: actions/checkout@v3
60+
with:
61+
62+
# By default, the `pull_request` event has a `GITHUB_SHA` env variable
63+
# set to the "last merge commit on the GITHUB_REF branch" (see
64+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request).
65+
# But we want to check out the latest commit on the branch whether or
66+
# not it is a merge commit, so this is how we do that.
67+
ref: "${{ github.event.pull_request.head.sha }}"
6068

6169
- run: git fetch origin master # check the master branch for benchmarking
6270

.github/workflows/flags.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ jobs:
2323
steps:
2424
# Need the repo checked out in order to read the file
2525
- uses: actions/checkout@v3
26+
with:
27+
28+
# By default, the `pull_request` event has a `GITHUB_SHA` env variable
29+
# set to the "last merge commit on the GITHUB_REF branch" (see
30+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request).
31+
# But we want to check out the latest commit on the branch whether or
32+
# not it is a merge commit, so this is how we do that.
33+
ref: "${{ github.event.pull_request.head.sha }}"
34+
2635
- id: ghcs
2736
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
2837
- id: skip_check

0 commit comments

Comments
 (0)