Skip to content
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

feat: add team reviewers #56

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

amondnet
Copy link

@amondnet amondnet commented Sep 9, 2021

https://docs.github.com/en/organizations/organizing-members-into-teams/managing-code-review-assignment-for-your-team

By using code review assignments, any time your team has been requested to review a pull request, the team is removed as a reviewer and a specified subset of team members are assigned in the team's place. Code review assignments allow you to decide whether the whole team or just a subset of team members are notified when a team is requested for review.

Copy link

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Nb: I'm not a member of this project, would just like to see this merged.)

Aside from some formatting issues and the apparently inadvertent removal of package-lock.json, this looks like it would do what it's supposed to.

src/handler.ts Outdated
@@ -96,6 +98,15 @@ export async function handlePullRequest(
}

if (addReviewers) {
if ( teamReviewers.length > 0 ) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( teamReviewers.length > 0 ) {
if (teamReviewers.length > 0) {

src/handler.ts Outdated
Comment on lines 103 to 104
await pr.addTeamReviewers(teamReviewers)
core.info(`Added team_reviewers to PR #${number}: ${teamReviewers.join(', ')}`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await pr.addTeamReviewers(teamReviewers)
core.info(`Added team_reviewers to PR #${number}: ${teamReviewers.join(', ')}`)
await pr.addTeamReviewers(teamReviewers)
core.info(`Added team_reviewers to PR #${number}: ${teamReviewers.join(', ')}`)

@amondnet amondnet marked this pull request as ready for review December 13, 2022 03:35
@kentaro-m kentaro-m self-requested a review December 13, 2022 16:26
@NathanaelGandhi
Copy link

This could close #12 (once the conflicts are resolved) and it looks like a quite sort-after feature

Copy link
Contributor

@benjlevesque benjlevesque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, much needed feature 🙏

I wonder if it's necessary to have both a reviewers and team_reviewers field? I think the change could be made simpler with only one field, and only one call to createReviewRequest, with users in the reviewers field, and teams in the team_reviewers field.

The distinction between users and teams can be made using the format org/team-slug

looking forward to seeing this merged!

} catch (error) {
if (error instanceof Error) {
core.warning(error.message)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think reviewers and teamReviewers should be mutually exclusive. Is there any limitation to have both a user and a team to review on a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants