-
-
Notifications
You must be signed in to change notification settings - Fork 14
44 lines (43 loc) · 1.4 KB
/
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
name: "Issue Labeler"
on:
issues:
types: [opened, edited]
jobs:
label-opened-and-edited:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let labels = [];
let setLabels = false;
context.payload.issue.labels.forEach(label => { labels.push(label.name) });
switch (context.payload.action) {
case 'opened':
case 'edited': {
if (context.payload.issue.title.match(/\[request\]|feature request/i)) {
labels.push('request');
}
if (context.payload.issue.title.match(/bug/i)) {
if (!labels.includes("confirmed bug")){
labels.push('potential bug');
labels.push('needs review');
setLabels = true;
}
}
if (labels.length === 0) {
labels.push('needs triage');
setLabels = true;
}
break;
}
}
if (setLabels) {
github.issues.setLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: labels
})
}