-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bot: Single Approval Paths #206
Conversation
Add the ability for certain PRs to require a single approval. A new setting has been added to the bot configuration file, singleApproverPaths, that defines paths in a repository that only require a single approver. If all the files in a PR only match paths defined in singleApproverPaths, then the PR only requires a single approval. Otherwise, the PR requires the default number of approvals, which is currently defined as 2.
I added a commit that moves the single approver paths from the config file to a Go literal. |
I added another commit that allows certain authors such as dependabot or renovate to only require a single approver.. |
// a set of authors that only require a single approver. 1 is returned when all of the | ||
// files match a single approver path or the PR author matches one of the authors, otherwise | ||
// env.DefaultApproverCount is returned. | ||
func approverCount(authors, paths []string, author string, files []github.PullRequestFile) int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enforce some sort of naming convention for bots that only require a single approval as an extra precaution? I don't think we'd ever want an employee to unconditionally only require a single approval.
Alternatively, we can just require that any author configured as a single approval also passes isAllowedRobot
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I added a test to ensure only bots can be configured as single approver authors. We can also export isAllowedRobot
from the review
package and test in approverCount
if you think we should have a secondary set of checks.
9c2b2e8
to
6e2ca8f
Compare
This PR addresses the "Single Approver" issue described in #205.
Add the ability for certain PRs to require a single approval.
A new setting has been added, singleApproverPaths, that defines paths in a repository that only require a single approver. If all the files in a PR only match paths defined in singleApproverPaths, then the PR only requires a single approval. Otherwise, the PR requires the default number of approvals, which is currently defined as 2.
A second setting was added, singleApproverAuthors, that defines PR authors that only require a single approval (dependency bots in cloud for now).