-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (58 loc) · 1.75 KB
/
setup-labels.yml
File metadata and controls
62 lines (58 loc) · 1.75 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
51
52
53
54
55
56
57
58
59
60
61
62
name: Setup Labels
on:
workflow_dispatch:
jobs:
setup-labels:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create labels
uses: actions/github-script@v7
with:
script: |
const labels = [
{
name: 'weekly-challenge',
color: '0052CC',
description: '주차별 공통 문제'
},
{
name: 'personal',
color: '0E8A16',
description: '개인 자유 문제'
},
{
name: '백준',
color: '5319E7',
description: '백준 문제'
},
{
name: '프로그래머스',
color: 'D93F0B',
description: '프로그래머스 문제'
},
{
name: '리트코드',
color: 'B60205',
description: '리트코드 문제'
}
];
for (const label of labels) {
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description
});
console.log(`✅ Created label: ${label.name}`);
} catch (error) {
if (error.status === 422) {
console.log(`⚠️ Label already exists: ${label.name}`);
} else {
console.error(`❌ Error creating label ${label.name}:`, error);
}
}
}