Home > Software engineering >  Prevent merging of branch conditionally based on label
Prevent merging of branch conditionally based on label

Time:03-17

My team uses private branches which do not have access to Draft Pull Requests, but I would still at least like a way to prevent merging pull requests while they have a custom label applied to them such as "Draft" or "WIP".

Is there a way to establish a custom required status check that checks for that label or uses a GitHub action to invalidate the PR until the label is removed or something like that?

CodePudding user response:

Since you don't have draft pull requests available, I assume you don't have branch protection rules as well. Therefore, you cannot really enforce what you describe in your question. However, it is possible to give some graphical hints to make the users aware that the PR is a draft.

This can be done with a workflow in fail

Successful run with no draft label on PR:

success

  • Related