diff --git a/.github/workflows/stale_remover.yml b/.github/workflows/stale_remover.yml index 7cb0a5c8b..774495b28 100644 --- a/.github/workflows/stale_remover.yml +++ b/.github/workflows/stale_remover.yml @@ -14,9 +14,17 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: 'Status: Stale' - }) + const labelToRemove = 'Status: Stale'; + const issueLabels = context.payload.issue.labels.map(label => label.name); + + if (issueLabels.includes(labelToRemove)) { + console.log(`Removing label: ${labelToRemove}`); + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: 'Status: Stale' + }); + } else { + console.log(`Label ${labelToRemove} is not present, skipping`); + }