-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (39 loc) · 1.57 KB
/
issue-gate.yml
File metadata and controls
45 lines (39 loc) · 1.57 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
name: Redirect issues to Discussions
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
check-author:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const association = context.payload.issue.author_association;
const login = context.payload.issue.user.login;
const allowed = ['OWNER', 'MEMBER', 'COLLABORATOR'];
const allowedBots = ['github-actions[bot]', 'dependabot[bot]'];
if (allowed.includes(association) || allowedBots.includes(login)) {
return;
}
{
await github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: [
'Thanks for reaching out! This project uses [Discussions](https://github.com/nerdalytics/beacon/discussions) as the entry point for bugs, feature requests, and ideas.',
'',
'Please open a discussion so the community can weigh in. Maintainers will create tracked issues from discussions that are confirmed and scoped.',
'',
'Closing this automatically — nothing personal!'
].join('\n')
});
await github.rest.issues.update({
...context.repo,
issue_number: context.issue.number,
state: 'closed',
state_reason: 'not_planned'
});
}