-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (76 loc) · 3.32 KB
/
issue_label.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Issue Labeling
on:
issue_comment:
types: [created]
issues:
types: [closed]
repository_dispatch:
types: [issue_closed]
jobs:
update-label:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set "검토 중" label on comment
if: github.event_name == 'issue_comment' && github.event.issue.state == 'open'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: "검토 중"
issue_number: ${{ github.event.issue.number }}
remove-label:
runs-on: ubuntu-latest
steps:
- name: Get all labels (issue 이벤트)
if: github.event_name == 'issues' && github.event.action == 'closed'
id: get_labels
run: |
labels=$(gh issue view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json labels --jq '.labels[].name' | tr '\n' '\n')
echo "labels<<EOF" >> $GITHUB_OUTPUT
echo "$labels" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get all labels (repository_dispatch 이벤트)
if: github.event_name == 'repository_dispatch' && github.event.action == 'issue_closed'
id: get_labels_repo
run: |
labels=$(gh issue view ${{ github.event.client_payload.issue_number }} --repo ${{ github.repository }} --json labels --jq '.labels[].name' | tr '\n' '\n')
echo "labels<<EOF" >> $GITHUB_OUTPUT
echo "$labels" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove all existing labels (issue 이벤트)
if: github.event_name == 'issues' && github.event.action == 'closed'
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.get_labels.outputs.labels }}
issue_number: ${{ github.event.issue.number }}
- name: Remove all existing labels (repository_dispatch 이벤트)
if: github.event_name == 'repository_dispatch' && github.event.action == 'issue_closed'
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.get_labels_repo.outputs.labels }}
issue_number: ${{ github.event.client_payload.issue_number }}
close-issue:
needs: remove-label
runs-on: ubuntu-latest
steps:
- name: Set "검토 완료" label on close (issue 이벤트)
if: github.event_name == 'issues' && github.event.action == 'closed'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: "검토 완료"
issue_number: ${{ github.event.issue.number }}
- name: Set "검토 완료" label on close (repository_dispatch 이벤트)
if: github.event_name == 'repository_dispatch' && github.event.action == 'issue_closed'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: "검토 완료"
issue_number: ${{ github.event.client_payload.issue_number }}