From 9606c0e0bbe054061714e48503d993a9aa8ca7b5 Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Fri, 23 May 2025 22:16:57 +0100 Subject: [PATCH 1/2] Remove stale labels as well as Waiting on Author labels actions/stale is far too slow to do this itself since it processes lots of irrelevant crap on every run --- .github/workflows/pr-remove-waiting-label.yml | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr-remove-waiting-label.yml b/.github/workflows/pr-remove-waiting-label.yml index eb46043bd..da14e36ba 100644 --- a/.github/workflows/pr-remove-waiting-label.yml +++ b/.github/workflows/pr-remove-waiting-label.yml @@ -15,19 +15,23 @@ jobs: with: github-token: ${{ github.token }} script: | - const [owner, repo] = context.payload.repository.full_name.split('/'); - 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; + function removeLabel(owner, repo, issue_number, name) { + try { + await github.rest.issues.removeLabel({ + owner: owner, + repo: repo, + issue_number: issue_number, + name: name, + }); + } catch (error) { + if (error.status === 404) { + //probably label wasn't set on the issue + console.log('Failed to remove label ' + name + ' (probably label isn\'t on the PR): ' + error.message); + } else { + throw error; + } } } + const [owner, repo] = context.payload.repository.full_name.split('/'); + removeLabel(owner, repo, context.payload.number, "Status: Waiting on Author"); + removeLabel(owner, repo, context.payload.number, "Stale"); From 3636173d75d7b97414c86d7c6f32bade005185e9 Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Fri, 23 May 2025 23:28:15 +0100 Subject: [PATCH 2/2] ... --- .github/workflows/pr-remove-waiting-label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-remove-waiting-label.yml b/.github/workflows/pr-remove-waiting-label.yml index da14e36ba..b7cd85acd 100644 --- a/.github/workflows/pr-remove-waiting-label.yml +++ b/.github/workflows/pr-remove-waiting-label.yml @@ -15,7 +15,7 @@ jobs: with: github-token: ${{ github.token }} script: | - function removeLabel(owner, repo, issue_number, name) { + async function removeLabel(owner, repo, issue_number, name) { try { await github.rest.issues.removeLabel({ owner: owner,