-
Notifications
You must be signed in to change notification settings - Fork 15
66 lines (53 loc) · 1.79 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
64
65
66
name: Label Predicate Changes
on:
pull_request:
types: [opened, synchronize]
issues:
types: [opened, edited]
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Label PR if predicates changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python -c "
from github import Github
g = Github("${{ secrets.GITHUB_TOKEN }}")
repo = g.get_repo("${{ github.repository }}")
if "issue" in github.event:
item = repo.get_issue(number=github.event.issue.number)
is_issue = True
else:
item = repo.get_pull(github.event.number)
is_issue = False
keywords = ["predicate", "biolink:"]
label_name = "Biological Context QC"
if any(keyword.lower() in item.title.lower() or keyword.lower() in item.body.lower() for keyword in keywords):
item.add_to_labels(label_name) # Add the label
"
- name: Assign if Labeled
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event.action == 'labeled' && github.event.label.name == 'Biological Context QC'
run: |
python -c "
from github import Github
g = Github("${{ secrets.GITHUB_TOKEN }}")
repo = g.get_repo("${{ github.repository }}")
issue_number = github.event.issue.number
issue = repo.get_issue(number=issue_number)
assignee = "eKathleenCarter"
issue.add_to_assignees(assignee)
"