newaperio / custodian

GitHub bot to manage routine tasks.
https://newaperio.github.io/custodian
MIT License
4 stars 1 forks source link

Don't delete branches with pending PRs #28

Open ngscheurich opened 5 years ago

ngscheurich commented 5 years ago

If a PR intends to merge branch B into branch A, but then branch A is deleted (say, for instance, it itself was merged), Custodian will delete branch B. We should instead give the user the opportunity to either choose a new target branch for branch B or delete it themselves.

lleger commented 5 years ago

On merging a PR, Custodian deletes the branch. But deleting the branch causes GitHub to close any PRs that are based on that branch.

This feature was added only considering PRs based off master, so we just need to make Custodian check the branch refs before taking action.

On PR close, Custodian should only delete a branch if there's not an open PR based on it. (If there is one, maybe it can comment and say it'll be deleted later.)

Custodian should also check the branch PRs are merged into on close. If not master and no other open PRs against that branch, it can delete it as well. This lets it clean up those other branches.