Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 969
Gaurang Shah Avatar asked Jan 01 '23 05:01

Gaurang Shah


1 Answers

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

like image 140
Raju Avatar answered Jan 13 '23 14:01

Raju