-
-
Notifications
You must be signed in to change notification settings - Fork 1k
52 lines (45 loc) · 1.64 KB
/
issues.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Issues
on:
issues:
types:
- opened
- reopened
- closed
jobs:
label_issues:
runs-on: ubuntu-latest
steps:
- name: Remove all 'state:' labels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
REPO=${{ github.repository }}
EXISTING_LABELS=$(gh issue view $ISSUE_NUMBER --repo $REPO --json labels --jq '.labels[].name')
for label in $EXISTING_LABELS; do
if [[ $label == state:* ]]; then
gh issue edit $ISSUE_NUMBER --remove-label "$label" --repo $REPO
fi
done
- name: Add 'state:Backlog' label on issue opened or reopened
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LABEL_NAME="state:Backlog"
REPO=${{ github.repository }}
ISSUE_NUMBER=${{ github.event.issue.number }}
if gh label list --repo $REPO | grep -q "$LABEL_NAME"; then
gh issue edit $ISSUE_NUMBER --add-label "$LABEL_NAME" --repo $REPO
fi
- name: Add 'state:Done' label on issue closed
if: ${{ github.event.action == 'closed' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LABEL_NAME="state:Done"
REPO=${{ github.repository }}
ISSUE_NUMBER=${{ github.event.issue.number }}
if gh label list --repo $REPO | grep -q "$LABEL_NAME"; then
gh issue edit $ISSUE_NUMBER --add-label "$LABEL_NAME" --repo $REPO
fi