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.yml
file 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 changes
action. As such, committers to a Pull Request are removed when calculatingmajority
orall
.
For example:
team-a
has four members, of whichmona
is one. Amajority
ofteam-a
would be3
. Ifmona
is a committer to the Pull Request, she cannot provide anapproved
review, so the newmajority
(for the Pull Request in question) is2
since, without her, there are3
remaining 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.15
or later, as Get-Consensus makes use of the checks API - be sure to set the
GHE_HOST
environment variable per the probot documentation
ISC © 2019 Philip Holleran [email protected]