Skip to content

Commit

Permalink
Merge branch 'main' into git-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon authored Apr 8, 2024
2 parents 264c13f + af2c668 commit b492c7e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,23 +407,29 @@ export const tagBackportReviewers = async ({
user?: string;
}) => {
const reviewers = [];
const teamReviewers = [];

if (DEFAULT_BACKPORT_REVIEW_TEAM) {
reviewers.push(DEFAULT_BACKPORT_REVIEW_TEAM);
// Optionally request a default review team for backports.
// Use team slug value. i.e electron/wg-releases => wg-releases
const slug =
DEFAULT_BACKPORT_REVIEW_TEAM.split('/')[1] ||
DEFAULT_BACKPORT_REVIEW_TEAM;
teamReviewers.push(slug);
}

if (user) {
const hasWrite = await checkUserHasWriteAccess(context, user);
// Optionally request a default review team for backports.
// If the PR author has write access, also request their review.
if (hasWrite) reviewers.push(user);
}

if (reviewers.length > 0) {
if (Math.max(reviewers.length, teamReviewers.length) > 0) {
await context.octokit.pulls.requestReviewers(
context.repo({
pull_number: targetPrNumber,
reviewers,
team_reviewers: teamReviewers,
}),
);
}
Expand Down

0 comments on commit b492c7e

Please sign in to comment.