update PR#2946 #895
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Create ROBOT diffs on Pull requests' | |
on: | |
issue_comment: | |
types: [created] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
diff-reports: | |
if: ${{ github.event.issue.pull_request }} | |
runs-on: macos-latest | |
permissions: | |
contents: read | |
pull-requests: read | |
steps: | |
- uses: khan/pull-request-comment-trigger@v1.1.0 | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: docker-practice/actions-setup-docker@master | |
if: steps.check.outputs.triggered == 'true' | |
- run: | | |
set -x | |
docker version | |
if: steps.check.outputs.triggered == 'true' | |
- name: Install ODK | |
run: docker pull obolibrary/odklite | |
if: steps.check.outputs.triggered == 'true' | |
# Checks-out current branch | |
- uses: xt0rted/pull-request-comment-branch@v1 | |
id: comment-branch | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
with: | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
# Checks-out master branch under "master" directory | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
with: | |
ref: master | |
path: master | |
- name: Diff classification | |
if: steps.check.outputs.triggered == 'true' | |
run: | | |
cd src/ontology | |
docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx9G' -e JAVA_OPTS='-Xmx9G' --rm obolibrary/odklite robot diff --left ../../master/src/ontology/uberon-edit.obo --left-catalog ../../master/src/ontology/catalog-v001.xml --right uberon-edit.obo --right-catalog catalog-v001.xml -f markdown -o edit-diff.md | |
- name: Upload diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: edit-diff.md | |
path: src/ontology/edit-diff.md | |
- name: Make step for branch | |
if: steps.check.outputs.triggered == 'true' | |
run: cd src/ontology && mkdir -p tmp reports mirror && docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx9G' -e JAVA_OPTS='-Xmx9G' --rm obolibrary/odklite make BRI=false MIR=false PAT=false IMP=false uberon-simple.owl > TESTLOG.log | |
- name: Make step for master | |
if: steps.check.outputs.triggered == 'true' | |
run: cd master/src/ontology && mkdir -p tmp reports mirror && docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx9G' -e JAVA_OPTS='-Xmx9G' --rm obolibrary/odklite make BRI=false MIR=false PAT=false IMP=false uberon-simple.owl > TESTLOG.log | |
- name: Diff report | |
if: steps.check.outputs.triggered == 'true' | |
run: | | |
cd src/ontology | |
docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx9G' -e JAVA_OPTS='-Xmx9G' --rm obolibrary/odklite robot diff --left ../../master/src/ontology/uberon-simple.owl --left-catalog catalog-v001.xml --right uberon-simple.owl --right-catalog ../../master/src/ontology/catalog-v001.xml -f markdown -o simple-report.md | |
- name: Upload diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: simple-report.md | |
path: src/ontology/simple-report.md | |
post_comment: | |
needs: [diff-reports] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: khan/pull-request-comment-trigger@v1.1.0 | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
- name: Download reasoned diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/download-artifact@v3 | |
with: | |
name: simple-report.md | |
- name: Prepare reasoned comment | |
run: "echo \"<details>\n <summary> Here's a diff of how these changes impact the classified ontology (on -simple file): </summary> \n\" > comment.md; cat simple-report.md >> comment.md" | |
if: steps.check.outputs.triggered == 'true' | |
- name: Post reasoned comment | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: NejcZdovc/comment-pr@v1.1.1 | |
with: | |
file: "../../comment.md" | |
identifier: "REASONED" | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
- name: Download edit diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/download-artifact@v2 | |
with: | |
name: 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-comment.md" | |
if: steps.check.outputs.triggered == 'true' | |
- name: Post comment | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: NejcZdovc/comment-pr@v1.1.1 | |
with: | |
file: "../../edit-comment.md" | |
identifier: "UNREASONED" | |