Conditionally suppress branch cleanup
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 339
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
I have a use case where I have two stacked PRs
PR1: Merge branch a into main
PR2: Merge branch b into a
I am using the queue action of mergify to merge PR1. As soon as mergify completes the merge of PR1, it deletes the branch a. Github then automatically updates PR2's base branch to main
eg screenshot:

This is not the behavior I'd like. Folks reviewing PR2 now end up unexpectedly seeing a new view (both PR1+PR2 squashed instead of just PR2) until I take some action on PR2 (to rebase on main or merge main).
For my workflow, I'd like branch a to hang around until it's safe to eliminate. I imagine an option to do this could go here https://docs.mergify.com/actions/queue/#id2.
Best would be to auto-cleanup a ONLY IF there don't exist any other PRs whose base is a. Thus when PR1 closes, no branches would be cleaned up. When PR2's base branch is changed to main, then and only then would mergify clean up a.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the queue action documentation at docs.mergify.com/actions/queue/#id2 and trace how branch cleanup is described and triggered after a merge. Define completion as preserving a merged branch while another open PR uses it as a base, then cleaning it up once no such PR remains; the payload names no implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100