You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just introduced a failing test into the main branch of a project; the failing tests (introduced in the commit triggering the build) appeared not to have run in the PR build.
When I look at the actions/checkout output, I am surprised by what I see.
Specifically, the build is running on commit 2dca06e -- however, actions/checkout appears to be merging the prior commit -- c0121d5 -- (without the tests) into the project's main branch.
[... trimmed ...]
- name: Checkout code
uses: actions/checkout@v2
with:
# Check out pull request's HEAD commit instead of the merge commit to
# work-around an issue where wrong a commit is being checked out.
# For more details, see:
# https://github.com/actions/checkout/issues/299.
ref: ${{ github.event.pull_request.head.sha }}
[... trimmed ...]
About 2 minutes after re-running the check reproduced the issue, I ran this locally, which resulted in fetching a correct merge, so I'm pretty sure the issue is on the action's end:
Beware: this checks out the current head of the branch, whereas by
default the action checks out the merge commit. By using this
workaround, you will no longer catch conflicting changes in the base
branch.
Is there a way to check out the correct merge commit without race
conditions? There’s the merge_commit_sha field, but the docs
indicate that that may be null if mergeability has not yet been
computed.
@tonyhallett: This is also incorrect, because it fetches the most
recent merge commit rather than the merge commit for the commit being
tested. Consider the following sequence:
Push commit A to PR 123.
CI queued on commit A. Merge commit not yet computed.
Push commit B to PR 123 (same PR).
GitHub computes the new merge commit to merge B into master.
CI run for commit A unqueues and starts running.
If at point (5) you fetch the current merge commit for PR 123, you
will be running on the code in commit B, not commit A. This would mean
that when you click the CI status indicator on commit A, it actually
shows you tests that ran at a different commit, which is obviously
unacceptable.
This issue [or one very similar] bit me today while using actions/checkout@v4 and got me extremely confused. Looked like some ghost merge commit was sitting on top of mine and making me think I was going nuts.
At first I noticed that HEAD wasn't the same as the HEAD on my PR
$ git rev-parse --short HEAD
c7e92e65a9
This commit was nowhere to be found on my branch or local repo.
Found it on the public repo here, unattached to anything...:
Looking a bit deeper ->
$ git show -s --format=raw HEAD
commit c7e92e65a99c531dbc3a16e6ffff5b58368196e4
tree 62d4ddfd7f526e63ea23be15b3e9537fa7f07f71
parent fcea7e4af940999a4068ef6981e945e0ac3ec36b
parent 46bb1463593dfedf9ef61a075eb3a74ffd5aabf5
author Maxime Beauchemin <[email protected]> 1747261433 +0000
committer GitHub <[email protected]> 1747261433 +0000
gpgsig
What is committer GitHub here? Where was that commit coming from?
For the record, I was able to fix the issue by adding:
Activity
jwilner commentedon Jul 11, 2020
Local discussion of issue: golangci/golangci-lint#1229
AustinShalit commentedon Jul 11, 2020
This is similar to #237
kenorb commentedon Jul 13, 2020
Same happens when using with
ad-m/github-push-action, related:I've described more details at #237 (comment)
ericsciple commentedon Jul 15, 2020
@andymckay fyi
medikoo commentedon Jul 22, 2020
This looks quite serious (allows to sneak not validated code as valid)
@ericsciple is there any specific timeline for this?
tjanez commentedon Jul 23, 2020
Also happened for oasisprotocol/oasis-core-ledger#16:
https://github.com/oasisprotocol/oasis-core-ledger/pull/16/checks?check_run_id=902853072
tjanez commentedon Jul 23, 2020
I was able to use the following work-around:
ruz commentedon Jul 24, 2020
This affects us, we found this documentation: https://developer.github.com/v3/pulls/#response-1. I searched code in this repository for mergeable and merge_commit_sha, but couldn't find anything. Feels like it's related.
ssantichaivekin commentedon Jul 24, 2020
I'm having the same problem in this pull request run: https://github.com/ssantichaivekin/empress/runs/900765234
It seems that this can be fixed by making a commit that is up to date with the current
origin/master. See ssantichaivekin/empress#184lethosor commentedon Jul 25, 2020
We just ran into what I think is another instance of this issue in https://github.com/DFHack/scripts/runs/910104637?check_suite_focus=true#step:4:375
This check ran on DFHack/scripts@5177a12, but ended up running on a merge between master and the previous commit on that branch (DFHack/scripts@1ec3d9b, as seen in the actions/checkout output), which produced a lot of irrelevant errors that the newer commit was intended to address. This issue repeated itself when we re-ran the check, so it appears to be reproducible in this case, but I'm not seeing an obvious reason why - the newer commit in that PR was pushed well after the checks run on the older commit failed,
and we haven't seen this in other PRs.Update: we've seen this in at least two PRs so far.About 2 minutes after re-running the check reproduced the issue, I ran this locally, which resulted in fetching a correct merge, so I'm pretty sure the issue is on the action's end:
ci: Revert Checkout Action to V1
ci: Revert Checkout Action to V1 (#1604)
Roll back to actions/checkout v1
Roll back to actions/checkout v1
13 remaining items
[CI] Work-around actions/checkout error
[CI] Work-around action/checkout bug
tests: checkout correct right ref
test: checkout correct right ref
test: checkout correct right ref
wchargin commentedon Mar 3, 2021
Beware: this checks out the current head of the branch, whereas by
default the action checks out the merge commit. By using this
workaround, you will no longer catch conflicting changes in the base
branch.
Is there a way to check out the correct merge commit without race
conditions? There’s the
merge_commit_shafield, but the docsindicate that that may be
nullif mergeability has not yet beencomputed.
tonyhallett commentedon Mar 23, 2021
@wchargin
Was you running on pull_request_target ? The ref and sha is different to pull_request
You can wait for the merge_commit_sha
I have not released my actions from ReleaseManager yet so here is the typescript code.
wchargin commentedon Mar 23, 2021
@tonyhallett: This is also incorrect, because it fetches the most
recent merge commit rather than the merge commit for the commit being
tested. Consider the following sequence:
If at point (5) you fetch the current merge commit for PR 123, you
will be running on the code in commit B, not commit A. This would mean
that when you click the CI status indicator on commit A, it actually
shows you tests that ran at a different commit, which is obviously
unacceptable.
Testing: Fix add_header job bug rucio#5197
Testing: Fix add_header job bug #5197
ethomson commentedon Feb 4, 2022
Closing, this is a dup of #237 and was resolved there. If you believe that you're seeing any problems here, please contact support.
Testing: Fix add_header job bug rucio#5197
Changing checkout workflow version from V2 to V1 avoid commits not ac…
mistercrunch commentedon May 14, 2025
This issue [or one very similar] bit me today while using
actions/checkout@v4and got me extremely confused. Looked like some ghost merge commit was sitting on top of mine and making me think I was going nuts.At first I noticed that HEAD wasn't the same as the HEAD on my PR
This commit was nowhere to be found on my branch or local repo.
Found it on the public repo here, unattached to anything...:

Looking a bit deeper ->
What is
committer GitHubhere? Where was that commit coming from?For the record, I was able to fix the issue by adding:
Now should I add this to all my GHAs to make sure it doesn't bite us again?