Skip to content

Commit

Permalink
fix: fix 404 when remove label that is not on the pr
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Jan 23, 2023
1 parent 0eb7c0b commit 8586e76
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/events/pr-handlers/actions/utils/syncLabel.ts
Expand Up @@ -122,7 +122,16 @@ export async function syncLabels<EventName extends EmitterWebhookEventName>(

if (labelsToRemove.length > 0) {
for (const label of labelsToRemove) {
updatedLabels = await removeLabel(context, pullRequest, label);
try {
updatedLabels = await removeLabel(context, pullRequest, label);
} catch (err) {
// can happen on old prs without all labels reviewflow expects
if ((err as any).status === 404) {
// do nothing, continue
} else {
throw err;
}
}
}
}
if (labelsToAdd.length > 0) {
Expand Down

0 comments on commit 8586e76

Please sign in to comment.