Skip to content

Commit

Permalink
Assign Github PR reviews in round-robin order. (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdale authored Oct 1, 2024
1 parent aeebb86 commit a693491
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .evergreen/github_app/assign-reviewer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ for (let line of reviewersSource.split('\n')) {
}
reviewers.push(line);
}
const reviewer = reviewers[Math.floor(Math.random() * reviewers.length)]
// Use the Github PR number to select the next reviewer in round-robin order. We
// assume that Github PR numbers are sequential and that the order of reviewer
// names is consistent across runs. Note that Github Issues must be disabled
// because they share the same number sequence with Github PRs.
const reviewer = reviewers[number % reviewers.length];

console.log("Assigning reviewer to PR...");
resp = await octokit.request("POST /repos/{owner}/{repo}/pulls/{number}/requested_reviewers", {
Expand Down

0 comments on commit a693491

Please sign in to comment.