-
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
Allow preferred docs reviewers #179
Conversation
For context, this |
5ef6bda
to
5390557
Compare
bot/internal/review/review.go
Outdated
if !strings.HasPrefix(file.Name, path) { | ||
continue | ||
} | ||
preferredReviewers = append(preferredReviewers, reviewers...) |
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.
Feels like this can result in the same reviewer being added multiple times - is this okay?
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.
Oversight on my part! I've changed this to deduplicate preferredReviewers
. The triple for
loop isn't the greatest (it also assumes the number of file paths and reviewers per path remains small), so I've explained the logic in a comment.
The code reviewer configuration allows us to name preferred reviewers for certain file paths. For docs PRs, the workflow bot does not consult the preferred reviewer configuration. This means that, even if we add the `preferredReviewerFor` key to a `codeReviewers` entry with a docs path as a value, the workflow bot continues to add only `docsReviewers` to docs PRs. In this change, the workflow bot gets docs reviewers by: 1. Retrieving the docs reviewer pool from the config (like it does now). 1. Retrieving all preferred reviewers for the file paths included within a PR. Since the pool of dedicated docs reviewers is small, the workflow bot gets all preferred reviewers for a file path, not just one. 1. Merging the two lists of reviewers. The alternative would be to allow preferred file paths in the docs reviewer pool, but it makes sense to have a small, consistent set of docs reviewers who have experience with docs reviews and a larger pool of subject matter experts for specific file paths from the code reviewer pool. Implementation notes: - Adds an `*Assignments.getAllPreferredReviewers` method, which fetches all preferred reviewers for all files in a change set, rather than limiting the number of reviewers per file to 1 as in `getPreferredReviewers`. This is necessary for `CheckInternal` to check that code reviewers with expertise over specific docs paths are counted as valid docs reviewers. - Changes `getDocsReviewers`, `CheckInternal`, and `checkInternalDocsReviews` to take a slice of `PullRequestFile`s so they can apply the `getPreferredReviewers` logic.
- Fix spelling. - Add log if admin reviewers are assigned. - Deduplicate preferred reviewers.
860c394
to
fc146a1
Compare
The code reviewer configuration allows us to name preferred reviewers for certain file paths. For docs PRs, the workflow bot does not consult the preferred reviewer configuration. This means that, even if we add the
preferredReviewerFor
key to acodeReviewers
entry with a docs path as a value, the workflow bot continues to add onlydocsReviewers
to docs PRs.In this change, the workflow bot gets docs reviewers by:
The alternative would be to allow preferred file paths in the docs reviewer pool, but it makes sense to have a small, consistent set of docs reviewers who have experience with docs reviews and a larger pool of subject matter experts for specific file paths from the code reviewer pool.
Implementation notes:
*Assignments.getAllPreferredReviewers
method, which fetches all preferred reviewers for all files in a change set, rather than limiting the number of reviewers per file to 1 as ingetPreferredReviewers
. This is necessary forCheckInternal
to check that code reviewers with expertise over specific docs paths are counted as valid docs reviewers.getDocsReviewers
,CheckInternal
, andcheckInternalDocsReviews
to take a slice ofPullRequestFile
s so they can apply thegetPreferredReviewers
logic.