-
-
Notifications
You must be signed in to change notification settings - Fork 713
67 lines (58 loc) · 3.13 KB
/
auto-close-issues.yml
File metadata and controls
67 lines (58 loc) · 3.13 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
name: Auto-close untriaged issues
on:
issues:
types: [opened, reopened]
permissions:
issues: write
jobs:
auto-close:
runs-on: ubuntu-latest
steps:
- name: Close issues from non-allowed authors
uses: actions/github-script@v7
with:
script: |
// Users allowed to open issues directly. All other authors will have
// their issues auto-closed. Add GitHub usernames (lowercase) here to
// grant additional contributors permission to open issues.
const allowedAuthors = [
'mdecimus',
];
const issue = context.payload.issue;
const author = (issue.user && issue.user.login) || '';
if (allowedAuthors.includes(author.toLowerCase())) {
core.info(`Issue #${issue.number} opened by allowed author '${author}'. Skipping.`);
return;
}
const comment = [
`Hi @${author}, thanks for taking the time to file this report.`,
``,
`This issue is being **automatically closed** because all bug reports in this repository must first be triaged in a [Discussion](https://github.com/stalwartlabs/stalwart/discussions/new?category=issue-triage). Once a maintainer has confirmed the report as a bug, an Issue will be created on your behalf. This process is described in the issue template and in [CONTRIBUTING](https://github.com/stalwartlabs/stalwart/blob/main/.github/ISSUE_TEMPLATE/config.yml), but it appears the instructions were ignored, most likely because this report was generated by an AI coding agent.`,
``,
`Please be aware that **AI-generated bug reports that have not been verified by a human consume a significant amount of maintainer time**: they are frequently inaccurate, fabricate symptoms or code paths that do not exist, and pull attention away from genuine issues affecting real users. If you are using an agent to interact with this project, please review its output and reproduce the problem yourself before reporting it, and always start in [Discussions](https://github.com/stalwartlabs/stalwart/discussions/new?category=issue-triage) rather than filing an Issue directly.`,
``,
`Thank you for understanding.`,
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: comment,
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed',
state_reason: 'not_planned',
});
try {
await github.rest.issues.lock({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
lock_reason: 'off-topic',
});
} catch (err) {
core.warning(`Could not lock issue #${issue.number}: ${err.message}`);
}