In a `pull_request` workflow, `git log -1` shows `Merge 4f1c2d3 into 9a8b7c6` and `git rev-parse HEAD` differs from the PR's head SHA.
IntermediateTroubleshootingGitHub, Actions and Pull Request Issues
Answer
Likely causes → For pull_request events, actions/checkout checks out refs/pull/<n>/merge, a temporary merge of the PR head into the base. That is intended (it tests the merge result), but it surprises tools that tag images or report status by HEAD.
Diagnose →
echo "$GITHUB_SHA" # merge commit SHA
echo "${{ github.event.pull_request.head.sha }}" # real PR head
Fix → If you need the PR head itself:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
Use github.event.pull_request.head.sha for image tags and commit statuses.
Prevent → Decide deliberately per workflow: merge ref for testing, head SHA for reporting.
More on GitHub, Actions and Pull Request Issues
A workflow step that pushes a version bump fails with `remote: Permission to org/repo.git denied to github-actions[bot].` and `The requested URL returned error: 403`.IntermediateA workflow pushes a commit or tag, but the workflow that should run on that push or tag never starts.IntermediateA container job fails on any Git command with `fatal: detected dubious ownership in repository at '/__w/app/app'`.IntermediateYour PR suddenly shows 340 changed files and dozens of commits you did not write.IntermediateThe PR is stuck on `Expected — Waiting for status to be reported` for a required check called `build`.IntermediateThe PR was approved, but merging shows "Review required" again after you pushed a small fix.Beginner