-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.48 KB
/
add-issue-to-project.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
name: Add Issue to Project
on:
issues:
types:
- opened
env:
PROJECT_NUMBER: 19
jobs:
add-labels-to-issue:
name: Add Labels to Issue
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
script: |
const issueTitle = context.payload.issue.title;
const labelList = [
{ icon: '🔮', label: 'epic' },
{ icon: '📗', label: 'story' },
{ icon: '✅', label: 'feature' },
{ icon: '🐞', label: 'bug' },
{ icon: '🔄', label: 'refactor' }
];
const labels = labelList.reduce((acc, { icon, label }) => {
if(issueTitle.indexOf(icon) > -1) {
acc.push(label);
}
return acc;
}, []);
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels,
});
add-issue-to-project:
name: Add Issue to Project
runs-on: ubuntu-latest
steps:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/boostcampwm2023/projects/${{ env.PROJECT_NUMBER }}
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}