File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Issues
2+
3+ on :
4+ issues :
5+ types :
6+ - opened
7+ - reopened
8+ - closed
9+
10+ jobs :
11+ label_issues :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v3
16+
17+ - name : Remove all 'state:' labels
18+ env :
19+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
20+ run : |
21+ ISSUE_NUMBER=${{ github.event.issue.number }}
22+ REPO=${{ github.repository }}
23+ EXISTING_LABELS=$(gh issue view $ISSUE_NUMBER --repo $REPO --json labels --jq '.labels[].name')
24+
25+ for label in $EXISTING_LABELS; do
26+ if [[ $label == state:* ]]; then
27+ gh issue edit $ISSUE_NUMBER --remove-label "$label" --repo $REPO
28+ fi
29+ done
30+
31+ - name : Add 'state:Backlog' label on issue opened or reopened
32+ if : ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
33+ env :
34+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ run : |
36+ LABEL_NAME="state:Backlog"
37+ REPO=${{ github.repository }}
38+ ISSUE_NUMBER=${{ github.event.issue.number }}
39+
40+ if gh label list --repo $REPO | grep -q "$LABEL_NAME"; then
41+ gh issue edit $ISSUE_NUMBER --add-label "$LABEL_NAME" --repo $REPO
42+ fi
43+
44+ - name : Add 'state:Done' label on issue closed
45+ if : ${{ github.event.action == 'closed' }}
46+ env :
47+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48+ run : |
49+ LABEL_NAME="state:Done"
50+ REPO=${{ github.repository }}
51+ ISSUE_NUMBER=${{ github.event.issue.number }}
52+
53+ if gh label list --repo $REPO | grep -q "$LABEL_NAME"; then
54+ gh issue edit $ISSUE_NUMBER --add-label "$LABEL_NAME" --repo $REPO
55+ fi
You can’t perform that action at this time.
0 commit comments