Mergifyio / mergify

Mergify Community Issue Tracker
https://mergify.com
Apache License 2.0
318 stars 92 forks source link

Conditionally suppress branch cleanup #4174

Open nipunn1313 opened 2 years ago

nipunn1313 commented 2 years ago

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:

image

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.

sileht commented 2 years ago

Mergify does not delete branches when it merges pull request.

Did you use the Mergify "delete head branch" action or the GitHub delete head branch setting ?