Issue Close Require #823
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: Issue Close Require | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| permissions: | |
| issues: write | |
| jobs: | |
| close-issues: | |
| if: github.repository == 'vitest-dev/vscode' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: needs reproduction | |
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 | |
| with: | |
| script: | | |
| const inactiveDays = 3; | |
| const cutoff = Date.now() - inactiveDays * 24 * 60 * 60 * 1000; | |
| const issues = await github.paginate(github.rest.issues.listForRepo, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| labels: 'needs reproduction', | |
| state: 'open', | |
| per_page: 100, | |
| }); | |
| for (const issue of issues) { | |
| if (issue.pull_request) continue; | |
| if (new Date(issue.updated_at).getTime() > cutoff) continue; | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| state: 'closed', | |
| state_reason: 'not_planned', | |
| }); | |
| } |