Skip to content

Commit

Permalink
copy-pasted jinja and edited as per Nico
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Mar 21, 2024
1 parent 448b5d5 commit c3ea1fa
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ontology_diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Post Markdown Comment on Pull Request

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
# pull_request:
# types: [opened, synchronize]

jobs:
post-comment:
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/ontology_diff_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: 'Create OAK diffs on Pull requests'

on:
# Triggers the workflow on pull request events for the master branch
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
edit_file:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
# Checks-out main branch under "main" directory
- uses: actions/checkout@v4
with:
ref: master
path: master

# - name: Install oaklib
# run: pip install oaklib

# - name: Diff classification
# run: |
# export ROBOT_JAVA_ARGS=-Xmx6G
# runoak -i simpleobo:tmp/hp-edit-master.obo diff -X simpleobo:tmp/hp-edit-pr.obo -o reports/difference_main-branch_base.md --output-type md

# - name: Upload diff
# uses: actions/upload-artifact@v4
# with:
# name: difference_main-branch_base.md
# path: src/ontology/reports/difference_main-branch_base.md
classify_branch:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v4
- name: Classify ontology
run: |
cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE hp-edit.owl && make tmp/hp-edit.obo
- name: Upload PR hp-edit.obo
uses: actions/upload-artifact@v4
with:
name: hp-edit-pr.obo
path: src/ontology/tmp/hp-edit.obo
retention-days: 1
classify_main:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Classify ontology
run: cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE hp-edit.owl && make tmp/hp-edit.obo
- name: Upload master hp-edit.obo
uses: actions/upload-artifact@v4
with:
name: hp-edit-master.obo
path: src/ontology/tmp/hp-edit.obo
retention-days: 1
diff_classification:
needs:
- classify_branch
- classify_main
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v4
- name: Download master classification
uses: actions/download-artifact@v4
with:
name: hp-edit-master.obo
path: src/ontology/tmp/hp-edit-master.obo
- name: Download PR classification
uses: actions/download-artifact@v4
with:
name: hp-edit-pr.obo
path: src/ontology/tmp/hp-edit-pr.obo
- name: Diff classification
run: |
export ROBOT_JAVA_ARGS=-Xmx6G; cd src/ontology;
runoak -i simpleobo:tmp/hp-edit-master.obo diff -X simpleobo:tmp/hp-edit-pr.obo -o reports/difference_main-branch_base.md --output-type md
- name: Upload diff
uses: actions/upload-artifact@v4
with:
name: difference_main-branch_base.md
path: src/ontology/reports/difference_main-branch_base.md
post_comment:
needs: [diff_classification, edit_file]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download reasoned diff
uses: actions/download-artifact@v4
with:
name: difference_main-branch_base.md
path: src/ontology/reports/difference_main-branch_base.md
- name: Prepare reasoned comment
run: "echo \"<details>\n <summary> Here's a diff of how these changes impact the classified ontology: </summary> \n\" >comment.md; cat difference_main-branch_base.md/difference_main-branch_base.md >>comment.md"
- name: Post reasoned comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: NejcZdovc/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
file: "../../comment.md"
identifier: "REASONED"
- uses: actions/checkout@v4
- name: Download edit diff
uses: actions/download-artifact@v4
with:
name: edit-diff.md
path: edit-diff.md
- name: Prepare edit file comment
run: "echo \"<details>\n <summary> Here's a diff of your edit file (unreasoned) </summary> \n\" >edit-comment.md; cat edit-diff.md/edit-diff.md >>edit-comment.md"
- name: Post comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: NejcZdovc/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
file: "../../edit-comment.md"
identifier: "UNREASONED"

0 comments on commit c3ea1fa

Please sign in to comment.