-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (42 loc) · 1.69 KB
/
IssueMange.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: Manage Issue Labels
permissions:
issues: write
contents: write
on:
issues:
types: [opened, closed]
jobs:
manage-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create or add label for new issues
if: ${{ github.event.action == 'opened' }}
run: |
LABEL_NAME="等待处理"
LABEL_COLOR="ff0000" # You can change the color code as needed
# Create the label if it doesn't exist
if ! gh label list | grep -q "$LABEL_NAME"; then
gh label create "$LABEL_NAME" --color "$LABEL_COLOR" --description "Issues awaiting processing"
fi
# Add the label to the new issue
gh issue edit ${{ github.event.issue.number }} --add-label "$LABEL_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Manage labels for closed issues
if: ${{ github.event.action == 'closed' }}
run: |
LABEL_TO_REMOVE="等待处理"
LABEL_TO_ADD="已处理"
LABEL_COLOR="00ff00" # You can change the color code as needed
# Remove the "等待处理" label
gh issue edit ${{ github.event.issue.number }} --remove-label "$LABEL_TO_REMOVE"
# Create the "已处理" label if it doesn't exist
if ! gh label list | grep -q "$LABEL_TO_ADD"; then
gh label create "$LABEL_TO_ADD" --color "$LABEL_COLOR" --description "Processed issues"
fi
# Add the "已处理" label to the issue
gh issue edit ${{ github.event.issue.number }} --add-label "$LABEL_TO_ADD"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}