Stale Issues #705
This file contains 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: Stale Issues | |
on: | |
schedule: | |
- cron: "30 1 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
close-stale-issues: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b | |
with: | |
days-before-issue-stale: 3 | |
days-before-issue-close: 3 | |
stale-issue-label: "to-be-closed" | |
exempt-issue-labels: "in-progress" | |
close-issue-reason: "completed" | |
stale-issue-message: "This case has been marked as 'to-be-closed', since it has no activity for the 3 days.<br />It will be automatically closed in another 3 days of inactivity." | |
close-issue-message: "This case has been closed, since it has no activity for the last 6 days. Feel free to reopen it, if you need more help." | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Remove 'to-be-closed' label from closed issues | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { repo, owner } = context.repo; | |
const labelToRemove = "to-be-closed"; | |
const query = `is:issue is:closed label:"${labelToRemove}" repo:${owner}/${repo}`; | |
const issues = await github.paginate(github.rest.search.issuesAndPullRequests, { q: query }); | |
for (const issue of issues) { | |
await github.rest.issues.removeLabel({ | |
owner, | |
repo, | |
issue_number: issue.number, | |
name: labelToRemove, | |
}); | |
} | |