-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
31 lines (29 loc) · 1.22 KB
/
check_issues_access.yml
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
# Not allow users without write access to create "infra" or blank issues.
name: Check issues access
on:
issues:
types: [ opened, reopened ]
jobs:
verify_access:
runs-on: ubuntu-latest
if: ${{ join(github.event.issue.labels) == '' || contains(github.event.issue.labels.*.name, 'infra')}}
steps:
- uses: actions-cool/check-user-permission@v2
id: checkIfUserHasWriteAccess
with:
require: 'write'
- name: Close issues if no access
if: steps.checkIfUserHasWriteAccess.outputs.check-result == false
uses: actions-cool/[email protected]
with:
actions: 'close-issue'
issue-number: ${{ github.event.issue.number }}
- name: Write comment
if: steps.checkIfUserHasWriteAccess.outputs.check-result == false
uses: actions-cool/[email protected]
with:
actions: 'create-comment'
issue-number: ${{ github.event.issue.number }}
body: |
@${{ github.event.issue.user.login }} Infra and blank issues are only available for moderators. You're apperantly using the wrong issue template.
> Infra 和空白 issue 仅供管理人员使用,请选择其他 issue 模板创建 issue。