-
Notifications
You must be signed in to change notification settings - Fork 256
Auto Assign Reviewers for PRs #2643
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
Conversation
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.
Pull Request Overview
Adds a GitHub Actions workflow that automatically assigns one random reviewer from the eng
team plus a fixed reviewer on new pull requests.
- Introduces
.github/workflows/random-reviewer-assignment.yml
- Uses
actions/github-script@v6
to list team members, exclude the author, pick one at random, and request reviews
Comments suppressed due to low confidence (5)
.github/workflows/random-reviewer-assignment.yml:6
- GitHub API call to list organization members requires explicit permission scope; add a
permissions: members: read
block to ensure GITHUB_TOKEN can list org team members.
env:
.github/workflows/random-reviewer-assignment.yml:21
- [nitpick] Hard-coded
team_slug: 'eng'
makes this workflow less reusable; consider parameterizing the organization and team slug via inputs or environment variables.
team_slug: 'eng'
.github/workflows/random-reviewer-assignment.yml:29
- [nitpick] The exclusion of a specific user (
"lagoja"
) is hard-coded; it would be clearer to move this into a configurable list or input to avoid future edits in code.
.filter(login => login !== "lagoja");
.github/workflows/random-reviewer-assignment.yml:44
- Always requesting a review from
"lagoja"
may assign the PR author if they arelagoja
; add a conditional to skip adding the fixed reviewer when they are the author.
reviewers: [randomReviewer, "lagoja"]
.github/workflows/random-reviewer-assignment.yml:48
- Use
core.setFailed(error.message)
in a GitHub Actions script rather thanconsole.error
, so the step properly fails and downstream steps stop.
console.error('Error assigning reviewer:', error);
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: John Lago <750845+Lagoja@users.noreply.github.com>
const prAuthor = context.payload.pull_request.user.login; | ||
const eligibleReviewers = teamMembers.data | ||
.map(member => member.login) | ||
.filter(login => login !== prAuthor) | ||
.filter(login => login !== "lagoja"); |
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 skip auto-assignment is author is on team?
Summary
TSIA, add myself + 1 random reviewer from our eng org.
How was it tested?
Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.