Skip to content

PR review bot#3326

Open
souvikghosh04 wants to merge 7 commits intomainfrom
Usr/sogh/prreviewbot
Open

PR review bot#3326
souvikghosh04 wants to merge 7 commits intomainfrom
Usr/sogh/prreviewbot

Conversation

@souvikghosh04
Copy link
Copy Markdown
Contributor

Why make this change?

Adding workflow for automated PR reviews

What is this change?

workflow YAML for automated PR reviews added

@souvikghosh04 souvikghosh04 self-assigned this Mar 26, 2026
@souvikghosh04 souvikghosh04 marked this pull request as ready for review March 26, 2026 17:38
Copilot AI review requested due to automatic review settings March 26, 2026 17:38
@souvikghosh04 souvikghosh04 added this to the April 2026 milestone Mar 26, 2026
@souvikghosh04 souvikghosh04 linked an issue Mar 26, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

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 intended to automatically assign reviewers to PRs based on labels and a simple load-balancing heuristic.

Changes:

  • Introduces .github/workflows/auto-assign-reviewers.yml to 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.

@souvikghosh04 souvikghosh04 moved this from Todo to In Progress in Data API builder Mar 27, 2026
@aaronburtle aaronburtle self-assigned this Mar 28, 2026
@aaronburtle aaronburtle moved this from In Progress to Review In Progress in Data API builder Mar 28, 2026
Copy link
Copy Markdown
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

with the current mechanism, this workflow will end up continuing here always and skipping explicit assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

Automated PR review assignment bot

4 participants