-
-
Notifications
You must be signed in to change notification settings - Fork 120
38 lines (35 loc) · 1.17 KB
/
Copy pathissue-close-require.yml
File metadata and controls
38 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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',
});
}