-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 1.97 KB
/
label_new_issues.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
name: Issue Labeler for Dropdown
on:
issues:
types: [opened]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |
const issueBody = context.payload.issue.body;
const shfwLabel = 'shfw';
const shutLabel = 'shut';
const criticalLabel = 'critical';
const highLabel = 'high';
const mediumLabel = 'medium';
const lowLabel = 'low';
let labelsToAdd = [];
if (issueBody.includes('Firmware (SHFW)')) {
labelsToAdd.push(shfwLabel);
}
if (issueBody.includes('Utility (SHUT)')) {
labelsToAdd.push(shutLabel);
}
if (issueBody.includes('low (asthetic, minor issue)')) {
labelsToAdd.push(lowLabel);
}
if (issueBody.includes('medium (affects usability but has a workaround)')) {
labelsToAdd.push(mediumLabel);
}
if (issueBody.includes('high (major functionality broken, no workaround)')) {
labelsToAdd.push(highLabel);
}
if (issueBody.includes('critical (app crash, data loss)')) {
labelsToAdd.push(criticalLabel);
}
if (issueBody.includes('low (take your time)')) {
labelsToAdd.push(lowLabel);
}
if (issueBody.includes('medium (upcoming releases)')) {
labelsToAdd.push(mediumLabel);
}
if (issueBody.includes('high (definitely next release)')) {
labelsToAdd.push(highLabel);
}
if (labelsToAdd.length > 0) {
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: labelsToAdd
});
}