-
Notifications
You must be signed in to change notification settings - Fork 29
96 lines (86 loc) · 2.98 KB
/
auto-pr-ontobot.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Create new pull request
on:
workflow_dispatch:
issues:
types: [ opened, edited ]
jobs:
check:
runs-on: ubuntu-latest
outputs:
phraseExists: ${{ steps.check-body.outputs.result }}
steps:
- name: Check if issue body contains 'Hey ontobot'
id: check-body
uses: actions/github-script@v6
with:
script: |
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
if (!issue.data.body) {
console.log('Issue body is empty or null');
return false;
}
return issue.data.body.toLowerCase().includes('hey ontobot');
build:
needs: check
if: needs.check.outputs.phraseExists == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9"]
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Return issue number
id: gh-script-issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ONTOBOT_TOKEN }}
script: |
const issue_number = context.issue.number
const repo = context.repo.owner+"/"+context.repo.repo
return issue_number
- name: Return repository name
id: gh-script-repo
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ONTOBOT_TOKEN }}
script: |
const repo = context.repo.owner+"/"+context.repo.repo
return repo
- name: Set branch name
id: vars
run: |
echo "branch-name=ochange_automation_"${{ steps.gh-script-issue.outputs.result }} >> $GITHUB_ENV
echo "resource=src/ontology/uberon-edit.obo" >> $GITHUB_ENV
- name: Install dependencies
run: |
pip install ontobot-change-agent
- name: Run ochange
id: ochange
run: |
ochange process-issue ${{ env.resource }} \
-r ${{ steps.gh-script-repo.outputs.result }} \
-n ${{ steps.gh-script-issue.outputs.result }} \
-g ${{ secrets.ONTOBOT_TOKEN }} \
-p UBERON
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
if: ${{ env.PR_TITLE}}
with:
branch-suffix: short-commit-hash
labels: Automated
body: ${{ env.PR_BODY }}
title: ${{ env.PR_TITLE }}
author: ${{ env.ISSUE_CREATOR }} <${{ env.ISSUE_CREATOR }}@users.noreply.github.com>
committer: ${{ env.ISSUE_CREATOR }} <${{ env.ISSUE_CREATOR }}@users.noreply.github.com>
base: ${{ github.head_ref }}
branch: ${{ env.branch-name }}
token: ${{ secrets.ONTOBOT_TOKEN }}