forked from flathub/flathub
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (46 loc) · 1.43 KB
/
lock-spams.yml
File metadata and controls
50 lines (46 loc) · 1.43 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
name: Close and lock spam issues and PRs
# WARNING: Do NOT use org level secrets or checkout any code in this
# workflow
on:
issues:
types: [labeled]
pull_request:
types: [labeled]
pull_request_target:
types: [labeled]
workflow_dispatch:
jobs:
spam_issues:
if: github.event.label.name == 'spam' && github.event.issue != null
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Close the issue
run: gh issue close "$ISSUE_NUM" --reason "not planned"
- name: Lock the issue
run: |
if [ "$(gh api repos/"$GH_REPO"/issues/"$ISSUE_NUM" --jq '.locked')" = "false" ]; then
gh issue lock "$ISSUE_NUM" --reason "spam"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
spam_prs:
if: github.event.label.name == 'spam' && github.event.pull_request != null
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Close the PR
run: gh pr close "$PR_NUM"
- name: Lock the PR
run: |
if [ "$(gh api repos/"$GH_REPO"/issues/"$PR_NUM" --jq '.locked')" = "false" ]; then
gh pr lock "$PR_NUM" --reason "spam"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUM: ${{ github.event.pull_request.number }}