-
Notifications
You must be signed in to change notification settings - Fork 69
45 lines (38 loc) · 1.11 KB
/
label-issue.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
name: Action Label Issue
on:
issues:
types:
- reopened
- opened
permissions:
issues: write
jobs:
label_issues:
runs-on: ubuntu-latest
steps:
- name: Label issue
uses: actions/github-script@v6
with:
script: |
const issueTitle = context.payload.issue.title.toLowerCase();
const labelsToAdd = [];
if (issueTitle.includes('bug')) {
labelsToAdd.push('bug');
}
if (issueTitle.includes('feature')) {
labelsToAdd.push('feature');
}
if (issueTitle.includes('enhancement')) {
labelsToAdd.push('enhancement');
}
if (issueTitle.includes('documentation')) {
labelsToAdd.push('documentation');
}
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labelsToAdd
});
}