-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (65 loc) · 3.1 KB
/
Copy pathissue-timeout.yml
File metadata and controls
77 lines (65 loc) · 3.1 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Issue — Auto-close on No Response
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
jobs:
close-unresponded:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Close issues with no author response after 24h
uses: actions/github-script@v7
with:
script: |
const now = Date.now();
const twentyFourHours = 24 * 60 * 60 * 1000;
const issues = await github.paginate(
github.rest.issues.listForRepo,
{
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
labels: "waiting-on-author",
per_page: 100
}
);
for (const issue of issues) {
if (issue.pull_request) continue;
const openedAt = new Date(issue.created_at).getTime();
if (now - openedAt < twentyFourHours) continue;
const author = issue.user.login;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
per_page: 100
});
const authorReplied = comments.data.some(c =>
c.user.login === author &&
new Date(c.created_at).getTime() > openedAt
);
if (authorReplied) {
try {
await github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, name: "waiting-on-author" });
await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, labels: ["in-progress"] });
} catch (e) {}
continue;
}
const closeBody = [
`Hey @${author} — this issue has been automatically closed because no additional information was received within **24 hours**.`,
``,
`This is not a rejection. If you still have the problem, please **reopen this issue** and include:`,
``,
`- The relevant log lines from your \`log.txt\``,
` - Location: \`Documents/My Games/FarmingSimulator2025/log.txt\``,
`- Your mod version (visible in the mod manager)`,
`- Steps to reproduce the issue`,
``,
`Without a log snippet it is very difficult to investigate issues. We look forward to helping you once we have the details!`,
].join("\n");
await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, body: closeBody });
await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, state: "closed", state_reason: "not_planned" });
core.info(`Closed issue #${issue.number} — no author response in 24h`);
}