checkout: Checking out wrong commit?
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.
Is this expected?
The project’s checkout configuration is completely vanilla: https://github.com/golangci/golangci-lint/blob/master/.github/workflows/pr.yml#L46
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 46
- Comments: 24 (5 by maintainers)
Commits related to this issue
- ci: Revert Checkout Action to V1 Revert actions/checkout to V1 from V2, as there are existing bugs within checkout@V2 causing it to possibly checkout the wrong commit SHA. See: - https://github.com... — committed to panicstevenson/cactbot by panicstevenson 4 years ago
- ci: Revert Checkout Action to V1 (#1604) Revert actions/checkout to V1 from V2, as there are existing bugs within checkout@V2 causing it to possibly checkout the wrong commit SHA. See: - https:... — committed to quisquous/cactbot by panicstevenson 4 years ago
- Roll back to actions/checkout v1 v2 uses the wrong commit sometimes (seen on #152 and #159 so far): actions/checkout#299 — committed to DFHack/scripts by lethosor 4 years ago
- Roll back to actions/checkout v1 v2 uses the wrong commit sometimes: actions/checkout#299 — committed to DFHack/df-structures by lethosor 4 years ago
- Roll back to actions/checkout v1 v2 uses the wrong commit sometimes: actions/checkout#299 — committed to DFHack/dfhack by lethosor 4 years ago
- NOISSUE: fix_ci_runs_on_wrong_commit (#573) try to fix problem, when GHA running not on the latest commit. It causes here https://github.com/insolar/assured-ledger/pull/568/checks?check_run_id=90199... — committed to insolar/assured-ledger by aalekseev-ru 4 years ago
- [CI] Work-around actions/checkout error 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. https://github.com/actions/c... — committed to lzhecheng/antrea by lzhecheng 4 years ago
- [CI] Work-around actions/checkout error 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. https://github.com/actions/c... — committed to lzhecheng/antrea by lzhecheng 4 years ago
- [CI] Work-around action/checkout bug 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://... — committed to lzhecheng/antrea by lzhecheng 4 years ago
- tests: checkout correct right ref Workaround for https://github.com/actions/checkout/issues/299 — committed to sileht/mergify-community by sileht 3 years ago
- test: checkout correct right ref Workaround for https://github.com/actions/checkout/issues/299 — committed to sileht/mergify-community by sileht 3 years ago
- test: checkout correct right ref Workaround for https://github.com/actions/checkout/issues/299 — committed to Mergifyio/mergify by sileht 3 years ago
- Testing: Fix add_header job bug #5197 The GitHub Checkout Actions checks out the wrong commit when the commit is force-pushed. This error is known and reported already. (https://github.com/actions/ch... — committed to joeldierkes/rucio by deleted user 2 years ago
- Testing: Fix add_header job bug #5197 The GitHub Checkout Actions checks out the wrong commit when the commit is force-pushed. This error is known and reported already. (https://github.com/actions/ch... — committed to rucio/rucio by deleted user 2 years ago
- Testing: Fix add_header job bug #5197 The GitHub Checkout Actions checks out the wrong commit when the commit is force-pushed. This error is known and reported already. (https://github.com/actions/ch... — committed to piperov/rucio by deleted user 2 years ago
- Changing checkout workflow version from V2 to V1 avoid commits not accounted for This happens in open pull requests when new commits are pushed to the merged branch. See https://github.com/actions/ch... — committed to IGNF/lidar-prod by CharlesGaydon 2 years ago
This looks quite serious (allows to sneak not validated code as valid)
@ericsciple is there any specific timeline for this?
I believe this is a dupe of #237, please see my comment here: https://github.com/actions/checkout/issues/237#issuecomment-667158637
@ericsciple which issue should we follow this one (#299) or #237?
I was able to use the following work-around:
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 benull
if mergeability has not yet been computed.@andymckay I was introducing CI in one branch and it started complaining about code from another, but they were mutex.
I had a couple of branches running at that point so don’t want to send it in and it turns out it was PEBKAC so I don’t waste your time. If it happens again, I’ll be sure to let you know. Thanks.
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 https://github.com/DFHack/scripts/commit/5177a127b32631fbcedc4b0e93e0c5c05a124388, but ended up running on a merge between master and the previous commit on that branch (https://github.com/DFHack/scripts/commit/1ec3d9b1a14c6b39b1bf0b907108a3e313eed955, 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: