Skip to content

Commit

Permalink
Type Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Cal-L committed Oct 26, 2023
1 parent 3636a1a commit b4d22d7
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/scripts/apply-e2e-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function main(): Promise<void> {
issue_number: issue_number,
name: e2eLabel,
});

if (removeLabelResponse.status === 200) {
console.log(`Removed (${e2eLabel}) label from PR ${pullRequestLink}`);
} else {
Expand All @@ -46,13 +46,20 @@ async function main(): Promise<void> {
);
process.exit(1);
}
} catch (error) {
if (error.message.includes('Label does not exist')) {
console.log(`(${e2eLabel}) label does not exist on ${pullRequestLink}, no need to remove`)
} catch (error: unknown) {
if (error instanceof Error) {
if (error.message.includes('Label does not exist')) {
console.log(
`(${e2eLabel}) label does not exist on ${pullRequestLink}, no need to remove`,
);
} else {
core.setFailed(
`An error occured when attempting to remove (${e2eLabel}) label from ${pullRequestLink}: ${error}`,
);
process.exit(1);
}
} else {
core.setFailed(
`An error occured when attempting to remove (${e2eLabel}) label from ${pullRequestLink}: ${error}`,
);
core.setFailed(`error object is not an instance of Error: ${error}`);
process.exit(1);
}
}
Expand Down

0 comments on commit b4d22d7

Please sign in to comment.