ci(pr-flow): add PR base guard — block stacked PRs#451
ci(pr-flow): add PR base guard — block stacked PRs#451
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new GitHub Actions workflow is introduced to validate that pull requests target the repository's default branch, rejecting PRs with incorrect base branch selection before proceeding. ChangesPR Base Guard Workflow
Estimated Code Review Effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions guard to prevent “stacked PR” workflows by enforcing that every pull request targets the repository’s default branch, avoiding downstream base desync under squash + auto-merge.
Changes:
- Introduces a new
pull_requestworkflow that fails whenpull_request.base.refis notrepository.default_branch. - Emits a clear error annotation explaining the policy and how to resolve it (rebase/retarget onto the default branch).
| run: | | ||
| if [ "$BASE_REF" != "$DEFAULT_BRANCH" ]; then | ||
| echo "::error::PR #${PR_NUMBER} base is '${BASE_REF}', must be '${DEFAULT_BRANCH}'." | ||
| echo "Stacked PRs are not supported. Branch from '${DEFAULT_BRANCH}' and merge serially." | ||
| exit 1 | ||
| fi | ||
| echo "OK: base '${BASE_REF}' matches default branch." |
Why
Sister project lazie had stacked PRs (#108/#109/#110) desync under squash + auto-merge today. Adding the same guard repo-wide.
Topology-aware auto-merge wouldn't fix it: squash merge produces new SHAs that downstream PR base refs don't reflect, so the chain breaks even with correct ordering.
What
.github/workflows/assert-base-is-default-branch.yml— any PR whosebase.ref != repository.default_branchfails. Branch from main, merge serially.Test plan
main→ check passes🤖 Generated with Claude Code
Summary by CodeRabbit