Note: This application is no longer maintained. If you're looking for a more robust solution to complex PR approval rules, with a robust community of users, please take a look at palantir/policy-bot.
A Probot app that lets repo admins require multiple reviewers from the same team by defining what constitutes consensus.
- Install the app
- Create a
.github/consensus.ymlfile in your repository
# these are the teams that will have a consensus enfored
teams:
# the slug of a team as defined in https://developer.github.com/v3/teams/#response
# this is also the team as defined in the url structure https://<gitHubHost>/<org/<teams>/<slug>
- slug: myTeam
# the consensus is the minimum number of approved reviews that constitue a consensus
# acceptable values are:
# * an integer
# * majority (conensus will calculate a simple majority for the team)
# * all (all team members)
consensus: majority
When a review is requested from a team (either via CODEOWNERS, the UI, or the API) Get-Consensus will create review requests for each team member. With each state change of the Pull Request the app will check to see if consensus was reached for each configured team.
Note: committers to a Pull Request cannot submit reviews with an
approved/request changesaction. As such, committers to a Pull Request are removed when calculatingmajorityorall.
For example:
team-ahas four members, of whichmonais one. Amajorityofteam-awould be3. Ifmonais a committer to the Pull Request, she cannot provide anapprovedreview, so the newmajority(for the Pull Request in question) is2since, without her, there are3remaining team members who can review.
Get-Consensus can be deployed to your own environment following the probot deployment documentation.
If deploying to GitHub Enterprise Server:
- you must be running version
2.15or later, as Get-Consensus makes use of the checks API - be sure to set the
GHE_HOSTenvironment variable per the probot documentation
ISC © 2019 Philip Holleran pholleran@github.com
