ci(workflow): auto-rebase stacked PRs on merge#133
Merged
Conversation
9fa0afe to
7e4a118
Compare
When a PR in a stack is merged (squash or rebase), GitHub retargets the next PR's base to main but doesn't rebase the branch — leaving stale parent commits in the diff. This workflow automates the fix: - Triggers on PR merge, finds child PRs stacked on the merged branch - Rebases each child onto the merged PR's base using `git rebase --onto` to replay only the child's own commits - Walks the full chain recursively to any depth (PR2 → PR3 → PR4...) - On conflict: leaves a comment with manual fix instructions, stops chain - Deletes the merged branch after rebasing (replaces GitHub auto-delete)
7e4a118 to
f397ea1
Compare
Contributor
|
Bash in yaml is uncool. Better have the logic in supported language with tests. May be outside this repo. |
sbalabanov
approved these changes
Mar 9, 2026
Collaborator
Author
Yes.. I am hoping Github releases something soon so i can delete this...if not i can port it to go and release a binary |
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.
Summary
When a PR in a stack is merged (squash or rebase), GitHub retargets the
next PR's base to main but doesn't rebase the branch — leaving stale
parent commits in the diff. This workflow automates the fix:
git rebase --ontoto replay only the child's own commits