Fix the squash-commit idempotency check to resolve in real action runs#43
Open
Phlogistique wants to merge 1 commit into
Open
Fix the squash-commit idempotency check to resolve in real action runs#43Phlogistique wants to merge 1 commit into
Phlogistique wants to merge 1 commit into
Conversation
4b8fab3 to
c4a89bd
Compare
has_squash_commit compared the target with a bare branch name like "main". actions/checkout leaves a detached HEAD and creates no local branches, so "main" does not resolve and git exits 128, which the if silently reads as "not up-to-date". The skip branch was therefore dead in CI and only worked in tests, where the test repos have every branch locally. This matters on the resume path: the push that finishes conflict resolution fires a synchronize event while the conflict label is still on. If that second run loses the race against the label removal, the broken check let it re-run the whole merge and push a second redundant synthetic merge commit. Compare against origin/$TARGET_BRANCH instead. With fetch-depth: 0 the remote-tracking ref always exists, so the check works in production while staying correct in tests.
c4a89bd to
9681264
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
has_squash_commit compared the target with a bare branch name like "main".
actions/checkout leaves a detached HEAD and creates no local branches, so
"main" does not resolve and git exits 128, which the if silently reads as
"not up-to-date". The skip branch was therefore dead in CI and only worked
in tests, where the test repos have every branch locally.
This matters on the resume path: the push that finishes conflict resolution
fires a synchronize event while the conflict label is still on. If that
second run loses the race against the label removal, the broken check let it
re-run the whole merge and push a second redundant synthetic merge commit.
Compare against origin/$TARGET_BRANCH instead. With fetch-depth: 0 the
remote-tracking ref always exists, so the check works in production while
staying correct in tests.