-
Notifications
You must be signed in to change notification settings - Fork 15
63 lines (53 loc) · 1.82 KB
/
labe-predicate-changes.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
61
62
63
name: Label Predicate Changes
on:
pull_request:
types: [opened, synchronize]
issues:
types: [opened, edited, labeled]
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Label PR if predicates changed
uses: actions/github-script@v6
with:
script: |
const keywords = ['predicate', 'biolink:'];
const labelName = 'Biological Context QC';
// Check if the event is for an issue
let item, number;
if (context.event.issue) {
// It's an issue
item = context.event.issue;
number = item.number;
} else {
// It's a pull request
item = context.payload.pull_request;
number = item.number;
}
// Check if the title or body contains any keywords
const containsKeyword = (text) => {
return keywords.some(keyword => text.toLowerCase().includes(keyword.toLowerCase()));
};
if (containsKeyword(item.title) || containsKeyword(item.body)) {
// Add label if keywords found
await github.issues.addLabels({
...context.repo,
issue_number: number,
labels: [labelName]
});
}
- name: Assign Issue if Labeled
uses: actions/github-script@v6
if: github.event.action == 'labeled' && github.event.label.name == 'Biological Context QC'
with:
script: |
const assignee = 'eKathleenCarter'; // Change this to the desired assignee's GitHub username
// Assign the issue
await github.issues.addAssignees({
...context.repo,
issue_number: context.issue.number,
assignees: [assignee]
});