Skip to content

Commit

Permalink
ci: use pull request head commit whenever possible
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weihanglo committed Aug 15, 2023
1 parent 7c3904d commit 4360d9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
runs-on: ubuntu-latest
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 4360d9d

Please sign in to comment.