From 98cf4819e858aeb2520cd1e7a4990107b89e8186 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 1 Nov 2024 16:17:46 +0200 Subject: [PATCH] Catch an error instead of crashing It was rate-limiting. Signed-off-by: Yarden Shoham --- src/labels.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/labels.ts b/src/labels.ts index 2114992..5a554f1 100644 --- a/src/labels.ts +++ b/src/labels.ts @@ -72,12 +72,13 @@ export const removeBackportLabelsFromPrsTargetingReleaseBranches = async () => { // versions return Promise.all(giteaVersions.map(async (version) => { const prs = await fetchTargeting(`release/v${version.majorMinorVersion}`); - console.info( - `Removing backport/* labels from PRs targeting v${version.majorMinorVersion}. The raw response from GitHub is:`, - ); - console.info(JSON.stringify(prs)); // PRs - return removeBackportLabelsFromPrs(prs.items); + try { + return removeBackportLabelsFromPrs(prs.items); + } catch (error) { + // we usually get here when GitHub rate limits us + console.error(error, JSON.stringify(prs)); + } })); };