SvanBoxel / delete-merged-branch

No more manually deleting merged branches, this lovely app does it for you.
https://github.com/apps/delete-merged-branch/
ISC License
323 stars 55 forks source link

[feature-request] Don't delete if label exists #79

Closed Jared-Dev closed 3 years ago

Jared-Dev commented 5 years ago

It would be handy if similar to exclude we could set an array of labels that, when present, prevent the branch from being deleted!

SvanBoxel commented 5 years ago

Hi @Jared-Dev , sound reasonable. I don't have a lot of bandwidth at the moment, but looking at your profile you're comfortable with javascript and probot apps. If you want to you can open a PR. 😄

Jared-Dev commented 5 years ago

If I have some time open up I can try to take a stab. Can you point me in a sensible direction or basic structure you'd like to see?

SvanBoxel commented 5 years ago

You need to extract the label from the issue, this is part of the event payload.

You probably want to look at an implementation that is similar to what is happening here:

https://github.com/SvanBoxel/delete-merged-branch/blob/be6c5ba3c5d9e19c04e60b28b7d5309ac3fd12fc/lib/delete-merged-branch.js#L16-L19

in the snippet above it looks in de app config for branchnames to exclude.

Jared-Dev commented 5 years ago

Since exclude is in use, do you have a preference on the name? I've started working on it a bit (I also don't have much bandwidth atm) and just added excludeLabels, but I really don't have much of an opinion there so...

GuillaumeFavelier commented 4 years ago

Something like "Don't delete if label exists" or "Delete only if label exists" would be a very good feature to have in my opinion. The option 2) can even help with https://github.com/SvanBoxel/delete-merged-branch/issues/8

SvanBoxel commented 3 years ago

Closing this feature request as it won't be implemented anytime soon. (Feel free to open a pr yourself if you want to see this functionality added)