-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,29 +3,36 @@ name: Check issues access | |
|
||
on: | ||
issues: | ||
types: [ opened, reopened ] | ||
types: [ opened, reopened, edited ] | ||
|
||
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 | ||
- uses: actions-cool/check-user-permission@v2.2.1 | ||
id: checkUser | ||
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/issues-helper@v2.1.2 | ||
if: steps.checkUser.outputs.check-result == 'false' | ||
uses: actions-cool/issues-helper@v3.6.0 | ||
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. | ||
@${{ github.event.issue.user.login }} Infra and blank issues are only available for moderators. You're apparently using the wrong issue template. | ||
> Infra 和空白 issue 仅供管理人员使用,请选择其他 issue 模板创建 issue。 | ||
- name: Close issue | ||
if: steps.checkUser.outputs.check-result == 'false' | ||
uses: actions-cool/[email protected] | ||
with: | ||
actions: 'close-issue' | ||
issue-number: ${{ github.event.issue.number }} | ||
- name: Lock issue | ||
if: steps.checkUser.outputs.check-result == 'false' | ||
uses: actions-cool/[email protected] | ||
with: | ||
actions: 'lock-issue' | ||
issue-number: ${{ github.event.issue.number }} | ||
lock-reason: 'off-topic' |