Skip to content

Commit 4360d9d

Browse files
committed
ci: use pull request head commit whenever possible
The `github.sha` is a merge commit with the parents of latest master and the head of the pr. Trying to diff the changes from that merge SHA to base will show all changes that have been made in-between. And that doesn't seem about right. We switch to `github.event.pull_request.head.sha` if there is a pr. See: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/version-bump.20CI.20failing
1 parent 7c3904d commit 4360d9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
runs-on: ubuntu-latest
8888
env:
8989
BASE_SHA: ${{ github.event.pull_request.base.sha }}
90-
HEAD_SHA: ${{ github.sha }}
90+
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
9191
steps:
9292
- uses: actions/checkout@v3
9393
with:

0 commit comments

Comments
 (0)