Conversation
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow intended to automatically assign reviewers to PRs based on labels and a simple load-balancing heuristic.
Changes:
- Introduces
.github/workflows/auto-assign-reviewers.ymlto select and request reviewers when PRs are opened/updated/labeled. - Implements label-based eligibility (
assign-for-review) and weighting (size-*,priority-high) to prioritize larger/higher priority PRs. - Tracks current reviewer “load” across open PRs to pick the least-loaded candidates.
Aniruddh25
left a comment
There was a problem hiding this comment.
Idea is good, but missing testing to ensure this actually works.
| function isEligible(pr) { | ||
| const labels = pr.labels.map((l) => l.name); | ||
| if (!labels.includes("assign-for-review")) return false; | ||
| // if (pr.draft) return false; |
There was a problem hiding this comment.
draft PRs are not eligible. why comment this out?
| if (!labels.includes("assign-for-review")) return false; | ||
| // if (pr.draft) return false; | ||
| const totalReviewers = (pr.requested_reviewers || []).length + (pr.requested_teams || []).length; | ||
| if (totalReviewers >= REQUIRED_REVIEWERS) return false; |
There was a problem hiding this comment.
by default, all owners get added to the review list - so this would return false pretty much always. But we need to still assign explicit 2 reviewers to each PR from the reviewers
|
|
||
| // Calculate PR weight from labels | ||
| function getWeight(pr) { | ||
| const labels = pr.labels.map((l) => l.name); |
There was a problem hiding this comment.
is the author supposed to add these size labels to their PRs?
|
|
||
| const loadRelevantPRs = allPRs.filter((pr) => { | ||
| const labels = pr.labels.map((l) => l.name); | ||
| return labels.includes("assign-for-review"); |
There was a problem hiding this comment.
are PR authors supposed to add these assign-for-review labels to their PRs?
|
|
||
| if (needed <= 0) { | ||
| core.info(`PR #${pr.number} already has ${REQUIRED_REVIEWERS} reviewers, skipping.`); | ||
| continue; |
There was a problem hiding this comment.
with the current mechanism, this workflow will end up continuing here always and skipping explicit assignment.
Why make this change?
Adding workflow for automated PR reviews
What is this change?
workflow YAML for automated PR reviews added