Chore(workflow): enforce independent PR branches with pre-push guard#595
Conversation
📝 WalkthroughWalkthroughThese changes introduce two new scripts for PR branch management: a pre-push git hook that enforces PR isolation by verifying branches are based on upstream/main and detecting commit cross-pollution across remote feature/fix/docs branches, and a PowerShell utility script that creates new PR branches from a specified base reference. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/new_pr_branch.ps1 (1)
12-12: Consider replacingWrite-HostwithWrite-Output.Per PSScriptAnalyzer,
Write-Hostbypasses the pipeline and can't be suppressed or captured.Write-Outputis more versatile for downstream scripting.Suggested change
-Write-Host "Created '$BranchName' from '$BaseRef'." +Write-Output "Created '$BranchName' from '$BaseRef'."
Summary
Adds an optional local workflow guard to reduce PR cross-pollution (stacked/overlapping feature branches).
Included changes
Add
.githooks/pre-pushupstream/mainorigin/feat*,origin/fix*, ororigin/docs*branchesAdd
scripts/new_pr_branch.ps1upstream/main:powershell -File scripts/new_pr_branch.ps1 -BranchName "<name>"Why
Prevents occurrences of PR cross-pollution where a new PR accidentally included commits from another open PR.
This guard makes that failure mode explicit before push.
Scope / Safety
Validation
upstream/maincore.hooksPath=.githooksSummary by CodeRabbit