Skip to content

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

Merged
merged 6 commits into from
Jul 3, 2025
Merged

Auto Assign Reviewers for PRs #2643

merged 6 commits into from
Jul 3, 2025

Conversation

Lagoja
Copy link
Contributor

@Lagoja Lagoja commented Jul 2, 2025

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.

@Lagoja Lagoja requested review from mikeland73 and Copilot July 2, 2025 21:39
Copy link
Contributor

@Copilot Copilot AI left a 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 are lagoja; 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 than console.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>
Comment on lines 29 to 33
const prAuthor = context.payload.pull_request.user.login;
const eligibleReviewers = teamMembers.data
.map(member => member.login)
.filter(login => login !== prAuthor)
.filter(login => login !== "lagoja");
Copy link
Contributor

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?

@Lagoja Lagoja merged commit dd069a4 into main Jul 3, 2025
33 checks passed
@Lagoja Lagoja deleted the jl/auto-assign-workflow branch July 3, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants