Skip to content

ci: check out PR head commits in workflows#21835

Merged
bolinfest merged 1 commit into
mainfrom
pr21835
May 8, 2026
Merged

ci: check out PR head commits in workflows#21835
bolinfest merged 1 commit into
mainfrom
pr21835

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented May 8, 2026

Why

PR CI should test the exact commit that was pushed to the PR branch. By default, GitHub's pull_request event checks out a synthetic merge commit from refs/pull/<number>/merge, so the tested tree can include an implicit merge with the current base branch instead of matching the pushed head SHA.

Using the PR head SHA makes each check result correspond to a concrete commit the author submitted. This also behaves better for stacked PR workflows, including Sapling stacks and other Git stack tooling: a middle PR's head commit already contains the lower stack changes in its tree, without pulling in commits above it or GitHub's temporary merge ref.

What Changed

  • Set every actions/checkout in pull_request workflows under .github/workflows to use github.event.pull_request.head.sha on PR events and github.sha otherwise.
  • Updated blob-size-policy to compare github.event.pull_request.base.sha and github.event.pull_request.head.sha, since it no longer checks out GitHub's merge commit where HEAD^1/HEAD^2 represented the PR range.

Verification

  • Parsed the edited workflow YAML files with Ruby.
  • Checked that every checkout block in the pull_request workflows has the PR-head ref.

@bolinfest bolinfest merged commit 2411179 into main May 8, 2026
29 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
@bolinfest bolinfest deleted the pr21835 branch May 8, 2026 22:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants