Skip to content

Commit 335648f

Browse files
authored
Continue removing labels with errors (#237)
1 parent b5db75d commit 335648f

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

dist/index.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -952,13 +952,23 @@ function run() {
952952
return;
953953
}
954954
const client = github.getOctokit(githubToken);
955+
const remaining = [];
955956
for (const label of labels) {
956-
yield client.issues.removeLabel({
957-
name: label,
958-
owner,
959-
repo,
960-
issue_number: number
961-
});
957+
try {
958+
yield client.issues.removeLabel({
959+
name: label,
960+
owner,
961+
repo,
962+
issue_number: number
963+
});
964+
}
965+
catch (e) {
966+
core.warning(`failed to remove label: ${label}: ${e}`);
967+
remaining.push(label);
968+
}
969+
}
970+
if (remaining.length) {
971+
throw new Error(`failed to remove labels: ${remaining}`);
962972
}
963973
}
964974
catch (e) {

src/main.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@ async function run(): Promise<void> {
2121

2222
const client = github.getOctokit(githubToken);
2323

24+
const remaining = [];
2425
for (const label of labels) {
25-
await client.issues.removeLabel({
26-
name: label,
27-
owner,
28-
repo,
29-
issue_number: number
30-
});
26+
try {
27+
await client.issues.removeLabel({
28+
name: label,
29+
owner,
30+
repo,
31+
issue_number: number
32+
});
33+
} catch (e) {
34+
core.warning(`failed to remove label: ${label}: ${e}`);
35+
remaining.push(label);
36+
}
37+
}
38+
39+
if (remaining.length) {
40+
throw new Error(`failed to remove labels: ${remaining}`);
3141
}
3242
} catch (e) {
3343
core.error(e);

0 commit comments

Comments
 (0)