Skip to content
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

refactor: add try catch to reviewer #279

Merged
merged 9 commits into from
Apr 10, 2024
Next Next commit
refactor: add try catch block with logging error message
alicelovescake committed Apr 9, 2024

Verified

This commit was signed with the committer’s verified signature.
dsanders11 David Sanders
commit 64d91522113be7428f3ab8e9f42c9c1cf21b9e8a
22 changes: 15 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -425,13 +425,21 @@ export const tagBackportReviewers = async ({
}

if (Math.max(reviewers.length, teamReviewers.length) > 0) {
await context.octokit.pulls.requestReviewers(
context.repo({
pull_number: targetPrNumber,
reviewers,
team_reviewers: teamReviewers,
}),
);
try {
await context.octokit.pulls.requestReviewers(
context.repo({
pull_number: targetPrNumber,
reviewers,
team_reviewers: teamReviewers,
}),
);
} catch (error) {
console.error(
`Failed to request reviewers for PR #${targetPrNumber}. Reviewers: ${reviewers.join(
', ',
)}, Team Reviewers: ${teamReviewers.join(', ')}. Error: ${error}`,
);
}
}
};