-
Notifications
You must be signed in to change notification settings - Fork 35
48 lines (45 loc) · 1.62 KB
/
main.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
name: Auto Label and Assign Based on Main Method Category
on:
issues:
types: [opened, edited]
jobs:
auto-label-and-assign:
runs-on: ubuntu-latest
steps:
- name: Label and Assign Based on Category
uses: actions/github-script@v7
with:
script: |
const issueBody = context.payload.issue.body;
const categories = {
'Training-Based': {
label: 'training',
assignees: ['Zwette', 'jiaxilv']
},
'Testing-Time Finetuning': {
label: 'testing-time finetuning',
assignees: ['liuyifan6613']
},
'Training and Finetuning Free': {
label: 'training & finetuning free',
assignees: ['huangjch526', 'mingfuyan']
}
};
Object.keys(categories).forEach(category => {
const pattern = new RegExp(`Main Method Category\\s*\\n\\s*${category}`);
if (pattern.test(issueBody)) {
const { label, assignees } = categories[category];
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [label],
});
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: assignees,
});
}
});