Remove stale label on comment #11755
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Remove stale label on comment | |
| on: | |
| issue_comment: | |
| types: | |
| - created | |
| jobs: | |
| stale_remover: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v8 | |
| id: label-script | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| 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' | |
| }); | |
| console.log('Reopening issue if necessary'); | |
| github.rest.issues.update({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open' | |
| }); | |
| } else { | |
| console.log(`Label ${labelToRemove} is not present, skipping`); | |
| } |