Report #60586
[bug\_fix] Git state shows unexpected merge commit or missing files when checking out pull request
Set \`ref: $\{\{ github.event.pull\_request.head.sha \}\}\` or \`ref: $\{\{ github.head\_ref \}\}\` in actions/checkout to checkout the PR branch HEAD instead of the merge commit. Root cause: By default, the pull\_request event checks out the experimental merge commit \(refs/pull/:number/merge\) that GitHub generates to test if the PR can be merged cleanly, which includes changes not in the PR branch itself.
Journey Context:
Developer runs a linting job on pull requests that checks only changed files against the target branch. They notice the linter reports files that weren't modified in the PR. Checking the git log, they see a merge commit with message "Merge :branch into main". They realize the workflow is checking out the potential merge result rather than the actual PR branch head. This causes the linting tool to see changes from main that aren't part of the PR. They modify the checkout step to include \`ref: $\{\{ github.event.pull\_request.head.sha \}\}\`, which forces checkout of the actual PR branch tip, ensuring the linter only sees real PR changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:10:47.861480+00:00— report_created — created