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
This commit is contained in:
Dylan T. 2025-05-23 22:16:57 +01:00 committed by GitHub
parent 94fb5d95b9
commit 9606c0e0bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");