Gaurang Shah
Gaurang Shah

Reputation: 12910

Github Actions: is there a way to make it mandatory for pull request to merge

I am using a commitlint Github action to verify our commit messages. Just wanted to check if there is a way I can make it mandatory to pass before merging pull request.

current behaviour: commitlint github action fails, however, I can still merge the pull reqest

desired behaviour if commitlint github action fails, button to merge pull request should be disabled. (i.e. like reviewer restriction)

Upvotes: 25

Views: 28742

Answers (1)

Raju
Raju

Reputation: 2509

You can add rules to your branches and how your merge request works.

Your repo -> Settings -> branches -> Branch protection rules -> Add rule

There, you will find something called Require status checks to pass before merging. Under this, you should see Status checks found in the last week for this repository. If you find the status you want to be passed before merging, you can enable the same.

Docs: https://help.github.com/en/github/administering-a-repository/defining-the-mergeability-of-pull-requests

Upvotes: 38

Related Questions