From 7460e12b6affaf097a63edf35a77bb0cbee7799f Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Sat, 23 Nov 2024 21:48:30 +0000 Subject: [PATCH] pr-remove-waiting-label: suppress failure on 404 errors this usually means the label wasn't on the PR in the first place --- .github/workflows/pr-remove-waiting-label.yml | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-remove-waiting-label.yml b/.github/workflows/pr-remove-waiting-label.yml index 0e411fe1a..eb46043bd 100644 --- a/.github/workflows/pr-remove-waiting-label.yml +++ b/.github/workflows/pr-remove-waiting-label.yml @@ -16,9 +16,18 @@ jobs: github-token: ${{ github.token }} script: | const [owner, repo] = context.payload.repository.full_name.split('/'); - await github.rest.issues.removeLabel({ - owner: owner, - repo: repo, - issue_number: context.payload.number, - name: "Status: Waiting on Author", - }); + try { + await github.rest.issues.removeLabel({ + owner: owner, + repo: repo, + issue_number: context.payload.number, + name: "Status: Waiting on Author", + }); + } catch (error) { + if (error.status === 404) { + //probably label wasn't set on the issue + console.log('Failed to remove label (probably label isn\'t on the PR): ' + error.message); + } else { + throw error; + } + }