ci: PR base-freshness guard against stale-base squash-merge (#516) - #528
Merged
Conversation
Fails a pull_request against main when its merge-base has drifted more than MAX_BEHIND (40) commits behind origin/main, forcing a rebase before merge. Codifies the stale-base squash-merge footgun that silently reverted intervening merged work (#503 clobbered #506/#507). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019vuFLFHnmJKmMxosHSWA4P
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.
Closes #516.
Adds a lightweight GitHub Action (
pr-base-freshness.yml) that fails a PR whose merge-base is more thanMAX_BEHIND(40) commits behind origin/main, forcing a rebase before merge — codifying the stale-base squash-merge footgun (PR #503 silently reverted #506/#507).Checks out the PR head sha (not the default merge ref, whose merge-base with main is always main’s tip → the guard would be a silent no-op), fetches origin/main explicitly, then
git rev-list --count merge-base..origin/main. Pure git, no external deps.🤖 Generated with Claude Code