-
Notifications
You must be signed in to change notification settings - Fork 327
PR review bot #3326
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
base: main
Are you sure you want to change the base?
PR review bot #3326
Changes from all commits
5ddd48f
5ff5538
d64bb42
12105c5
8c11874
7e2463c
d085f1f
9cfc781
0ec4dfc
77733d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,182 @@ | ||||||||||
| name: PR Review Assignment Bot | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| pull_request_target: | ||||||||||
| types: [opened, reopened, labeled] | ||||||||||
|
|
||||||||||
| workflow_dispatch: | ||||||||||
| inputs: | ||||||||||
| dry_run: | ||||||||||
| description: 'Run in dry-run mode (no actual assignments)' | ||||||||||
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| required: false | ||||||||||
| default: 'true' | ||||||||||
| type: choice | ||||||||||
| options: | ||||||||||
| - 'true' | ||||||||||
| - 'false' | ||||||||||
|
|
||||||||||
| # schedule: | ||||||||||
| # - cron: "*/10 * * * *" | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| pull-requests: write | ||||||||||
| contents: read | ||||||||||
|
|
||||||||||
| concurrency: | ||||||||||
| group: pr-review-assignment | ||||||||||
| cancel-in-progress: false | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| assign-reviewers: | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| steps: | ||||||||||
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| - name: Assign reviewers to eligible PRs | ||||||||||
| uses: actions/github-script@v7 | ||||||||||
| with: | ||||||||||
| script: | | ||||||||||
| const reviewers = ["souvikghosh04", "Aniruddh25", "aaronburtle", "anushakolan", "RubenCerna2079", "JerryNixon"]; | ||||||||||
| const REQUIRED_REVIEWERS = 2; | ||||||||||
| const DRY_RUN = '${{ github.event.inputs.dry_run || 'true' }}' === 'true'; | ||||||||||
|
||||||||||
| const DRY_RUN = '${{ github.event.inputs.dry_run || 'true' }}' === 'true'; | |
| const DRY_RUN = context.eventName === "workflow_dispatch" | |
| ? '${{ github.event.inputs.dry_run || 'true' }}' === 'true' | |
| : false; |
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Apr 3, 2026
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.
This workflow still ignores requested_teams when computing existing reviewers (configuredSet) and determining needed. If a PR already has team reviewers requested, this can result in extra individual assignments and incorrect load accounting. If teams should count toward the 2-reviewer threshold, include pr.requested_teams in the reviewer-count/eligibility logic (or explicitly encode that teams are intentionally excluded).
Copilot
AI
Apr 3, 2026
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.
pulls.listReviews is not paginated here and doesn't set per_page, so only the first page of reviews is considered (default 30). On PRs with many reviews this can miss configured reviewers who already submitted, leading to incorrect configuredSet/load and potentially re-requesting reviewers. Use github.paginate (or paginate with per_page: 100) for listReviews.
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
souvikghosh04 marked this conversation as resolved.
Show resolved
Hide resolved
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.
Does this action add the selected reviewer to the list of assignees of the PR or in the requested review column?
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.
The workflow triggers on every
pull_request_targetopenedevent, but then always fetches all open PRs to find ones withassign-for-review. For repos with frequent PR activity this can cause unnecessary API usage and increase the chance of hitting rate limits. Consider narrowing triggers (e.g., onlylabeledforassign-for-review) or adding a job-levelif:to quickly exit when the event isn'tworkflow_dispatchand isn't theassign-for-reviewlabel being applied.