From 1fc32403909992361ebf2e32c6a74d7447be21d8 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 15 Nov 2023 11:14:34 +0100 Subject: [PATCH] Fix single commit check when label did not exist The call to remove a label from a PR fails with 404 if that label did not exist. We can ignore this error. [noissue] --- .github/workflows/pr_checks.yml | 16 ++++++++++------ .../github/.github/workflows/pr_checks.yml.j2 | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 7b20d332..f9408566 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -37,14 +37,18 @@ jobs: with: script: | const { COMMIT_COUNT } = process.env + if (COMMIT_COUNT == 1) { - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: ["multi-commit"] - }) + try { + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: ["multi-commit"] + }) + } catch(err) { + } } else { diff --git a/templates/github/.github/workflows/pr_checks.yml.j2 b/templates/github/.github/workflows/pr_checks.yml.j2 index 513c65e1..2e1a5e1f 100644 --- a/templates/github/.github/workflows/pr_checks.yml.j2 +++ b/templates/github/.github/workflows/pr_checks.yml.j2 @@ -33,14 +33,18 @@ jobs: with: script: | const { COMMIT_COUNT } = process.env + if (COMMIT_COUNT == 1) { - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: ["multi-commit"] - }) + try { + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: ["multi-commit"] + }) + } catch(err) { + } } else {