Skip to content

Commit 5a89dbe

Browse files
clean up label checks
1 parent 21dfe86 commit 5a89dbe

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/autoupdater.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,6 @@ export class AutoUpdater {
505505
.map((l: any) => l.name)
506506
.filter(Boolean);
507507

508-
// Check that the label exists on the remote before applying it
509-
let labelExists = true;
510508
try {
511509
await this.octokit.rest.issues.getLabel({
512510
owner: mergeOpts.owner as string,
@@ -522,16 +520,16 @@ export class AutoUpdater {
522520
ghCore.error(
523521
`Merge conflict label '${mergeConflictLabel}' does not exist on the remote. Skipping label application.`,
524522
);
525-
labelExists = false;
523+
throw err;
526524
} else {
527525
ghCore.error(
528526
`Error checking for label '${mergeConflictLabel}': ${err}`,
529527
);
530-
labelExists = false;
528+
throw err;
531529
}
532530
}
533531

534-
if (labelExists && !currentLabels.includes(mergeConflictLabel)) {
532+
if (!currentLabels.includes(mergeConflictLabel)) {
535533
const newLabels = [...currentLabels, mergeConflictLabel];
536534
await this.octokit.rest.issues.update({
537535
owner: mergeOpts.owner as string,
@@ -542,10 +540,6 @@ export class AutoUpdater {
542540
ghCore.info(
543541
`Added merge conflict label '${mergeConflictLabel}' to PR #${prNumber}.`,
544542
);
545-
} else if (!labelExists) {
546-
ghCore.info(
547-
`Did not add label '${mergeConflictLabel}' because it does not exist on the remote.`,
548-
);
549543
} else {
550544
ghCore.info(
551545
`Merge conflict label '${mergeConflictLabel}' already present on PR #${prNumber}.`,

0 commit comments

Comments
 (0)