kodiak icon indicating copy to clipboard operation
kodiak copied to clipboard

delete branch when PR is closed

Open clxmstaab opened this issue 5 years ago • 3 comments

would it be possible that kodiak would delete the underlying branch of a pull request, when the pull request is closed?

we see stale branches in our repo, because devs close PRs but forget to do another click which removes the branch. all existing tools I am aware of delete the branches only on merge, but not on close.

clxmstaab avatar Nov 02 '20 14:11 clxmstaab

This seems doable. Do you have an idea about what the config option would be? Maybe we need a new config section because I don't think it fits into the [merge] section.

chdsbd avatar Nov 02 '20 23:11 chdsbd

I feel it could be a [close] section.

analog to merge.delete_branch_on_merge I guess it could be close.delete_branch_on_close.

what do you think.. would kodiak delete the branch only when a automerge label is present, or everytime? for my use-case I would want it deletes the branches even when no automerge label is present.

clxmstaab avatar Nov 03 '20 09:11 clxmstaab

I think an implementation for this would be similar to the logic for branch deletion on merge. We'd need to add a new config option and do something similar to delete_branch_on_merge:

https://github.com/chdsbd/kodiak/blob/2ecca4ed181432b192292084719e3796d9997812/bot/kodiak/evaluation.py#L736-L751

chdsbd avatar Nov 05 '20 22:11 chdsbd