forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 154
51 lines (49 loc) · 1.87 KB
/
labeler-mapping-issues-and-untriaged.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
name: "Mapping issues"
on:
issues:
type: [opened]
jobs:
add-labels-and-assigness:
runs-on: ubuntu-latest
steps:
- name: Check option and add label
uses: actions/github-script@v6
with:
script: |
const issueBody = context.payload.issue.body;
const options = {
'Frankenstein': {label: 'MI: Frankenstein', assignee: 'UrPrice' },
'Axioma': {label: 'MI: Axioma', assignee: 'NightmareStalker'},
'Donuts': {label: 'MI: Donuts', assignee: 'spo9k'},
'Eclipse': {label: 'MI: Eclipse', assignee: 'AliceValestray'},
'Astro': {label: 'MI: Astro', assignee: 'UrPrice'},
'Другое': {label: 'MI: Other', assignee: 'UrPrice'}
};
let selectedOption = null;
for (const option in options){
if (issueBody.includes(option)) {
selectedOption = options[option];
break;
}
}
if (selectedOption) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [selectedOption.label]
}); // added label
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: [selectedOption.assignee]
}); // added assignee
} else {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["Status: Needs Labels"]
}); // add "Status: Needs Labels"
}