NTR-pro-opiomelanocortin-neuron #2521
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] | |
env: | |
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
branch_status: | |
if: ${{ github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: xt0rted/pull-request-comment-branch@v1 | |
id: comment-branch | |
# Checks-out current branch | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
with: | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
fetch-depth: 0 | |
- name: Check current branch status | |
if: steps.check.outputs.triggered == 'true' | |
id: info | |
run: | | |
echo "status=$(git rev-list --left-right --count origin/$DEFAULT_BRANCH...origin/`git branch --show-current` | awk '{print $1}')" | |
echo "status=$(git rev-list --left-right --count origin/$DEFAULT_BRANCH...origin/`git branch --show-current` | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Warn users with a comment | |
if: steps.info.outputs.status >= 1 | |
run: echo "Your branch is ${{ steps.info.outputs.status }} commit/s behind, please update your branch. " > warncomment.md | |
- name: post comment | |
if: steps.info.outputs.status >= 1 && steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: NejcZdovc/[email protected] | |
with: | |
file: "../../warncomment.md" | |
- name: fail | |
if: steps.info.outputs.status >= 1 && steps.check.outputs.triggered == 'true' | |
run: | | |
echo "Your branch is ${{ steps.info.outputs.status }} commit/s behind, please update your branch. " | |
exit 1 | |
edit_file: | |
needs: [branch_status] | |
if: ${{ github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
container: obolibrary/odkfull:v1.5.3 | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- 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 }} | |
path: branch | |
# Checks-out main branch under "main" 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: export ROBOT_JAVA_ARGS=-Xmx6G; robot diff --labels True --left master/src/ontology/cl-edit.owl --left-catalog master/src/ontology/catalog-v001.xml --right branch/src/ontology/cl-edit.owl --right-catalog branch/src/ontology/catalog-v001.xml -f markdown -o edit-diff.md | |
- name: Upload diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: edit-diff.md | |
path: edit-diff.md | |
classify_branch: | |
needs: [branch_status] | |
if: ${{ github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
container: obolibrary/odkfull:v1.5.3 | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- 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 }} | |
- name: Classify ontology | |
if: steps.check.outputs.triggered == 'true' | |
run: cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE cl-base.owl | |
- name: Upload PR cl-base.owl | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cl-base-pr.owl | |
path: src/ontology/cl-base.owl | |
retention-days: 1 | |
classify_main: | |
needs: [branch_status] | |
if: ${{ github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
container: obolibrary/odkfull:v1.5.3 | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
with: | |
ref: master | |
- name: Classify ontology | |
if: steps.check.outputs.triggered == 'true' | |
run: cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE cl-base.owl | |
- name: Upload master cl-base.owl | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cl-base-master.owl | |
path: src/ontology/cl-base.owl | |
retention-days: 1 | |
diff_classification: | |
needs: [classify_branch, classify_main] | |
runs-on: ubuntu-latest | |
container: obolibrary/odkfull:v1.5.3 | |
steps: | |
- uses: khan/[email protected] | |
id: check | |
with: | |
trigger: '#gogoeditdiff' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: actions/checkout@v3 | |
if: steps.check.outputs.triggered == 'true' | |
- name: Download master classification | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/download-artifact@v4 | |
with: | |
name: cl-base-master.owl | |
path: src/ontology/cl-base-master.owl | |
- name: Download PR classification | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/download-artifact@v4 | |
with: | |
name: cl-base-pr.owl | |
path: src/ontology/cl-base-pr.owl | |
- name: Diff classification | |
if: steps.check.outputs.triggered == 'true' | |
run: export ROBOT_JAVA_ARGS=-Xmx6G; cd src/ontology; robot diff --labels True --left cl-base-master.owl/cl-base.owl --left-catalog catalog-v001.xml --right cl-base-pr.owl/cl-base.owl --right-catalog catalog-v001.xml -f markdown -o classification-diff.md | |
- name: Upload diff | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: classification-diff.md | |
path: src/ontology/classification-diff.md | |
post_comment: | |
needs: [diff_classification, edit_file] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: khan/[email protected] | |
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@v4 | |
with: | |
name: classification-diff.md | |
path: classification-diff.md | |
- name: Prepare reasoned comment | |
if: steps.check.outputs.triggered == 'true' | |
run: "echo \"<details>\n <summary> Here's a diff of how these changes impact the classified ontology (on -base file): </summary> \n\" >comment.md; cat classification-diff.md/classification-diff.md >>comment.md" | |
- name: Post reasoned comment | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: NejcZdovc/[email protected] | |
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@v4 | |
with: | |
name: edit-diff.md | |
path: edit-diff.md | |
- name: Prepare edit file comment | |
if: steps.check.outputs.triggered == 'true' | |
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 | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: NejcZdovc/[email protected] | |
with: | |
file: "../../edit-comment.md" | |
identifier: "UNREASONED" |