At ReviewNinja we often get the question, especially from enterprise teams. “How can we restrict merging before a review of a pull request has succeeded?”.

This is a feature request we have always hesitated to implement in ReviewNinja. A superficial disabling of the merge button would hardly be a proper solution, such a restriction could be easily circumvented by merging in git itself, or even easier, in GitHub. The right solution would need to address this problem on a lower level, at the git level itself.

And now with GitHub Protected Branches it is possible to enforce ReviewNinja code review. Additionally you can also enforce any tool integrated with the GitHub Status API, such as Travis, Coveralls, and many more.


How to enforce ReviewNinja code review

In your GitHub repo settings, open the “Branches” tab, and in the dropdown choose a branch to protect. Good candidates for protection are your develop, master, and/or release branch. Select both “Protect this branch” and “Require status checks to pass before merging”, you should then see a list of pre-existing statuses, select “code-review/reviewninja” (along with any other desired status checks), and save.

Screen Shot 2015-10-08 at 2.46.08 PM.png

Now, whenever a merge is attempted into this branch, the merge will be rejected until all required statuses have succeeded. Furthermore force pushes to this branch will always be rejected, even merges directly in git will be blocked when pushed to your GitHub remote.

Screen Shot 2015-10-09 at 2.48.55 PM.png

        Screen Shot 2015-10-08 at 3.16.42 PM.png

Et Voila

With GitHub, and some help from ReviewNinja, you can ensure the right quality checks are in place before successful deployments. We hope to see this feature soon in GitHub Enterprise where we expect it’s impact to be even greater.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply