For a pull_request event, what does 'github.sha' contain?
Select an answer to reveal the explanation.
Short Explanation and Infographic
For PRs, GitHub creates a synthetic merge commit and uses that SHA — it represents the merged result, not just the PR branch tip.
Full explanation below image
Full Explanation
For 'pull_request' events, 'github.sha' is the SHA of the automatically created merge commit that GitHub generates to test the PR (merging the PR head into the base). This is NOT the SHA of the latest commit pushed to the PR branch — that's in 'github.event.pull_request.head.sha'. This distinction matters for actions/checkout which defaults to this merge commit SHA. The base branch HEAD is 'github.event.pull_request.base.sha'. Understanding this helps when you need to check out the exact PR head commit vs the merged result.