Merge pull request #98 from PRIDE-Utilities/update-owl-file #15
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: "Update OWL" | |
on: | |
push: | |
branches: [master] | |
jobs: | |
generate-owl: | |
if: "! contains(github.event.head_commit.message, 'Update PRIDE OWL file')" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Extract version from OBO | |
run: | | |
CV_VERSION=`grep data-version pride_cv.obo | grep -oP "(\d+.\d+.\d+)"` | |
echo CV_VERSION=${CV_VERSION} | |
echo "CV_VERSION=${CV_VERSION}" >> $GITHUB_ENV | |
- name: Generate OWL | |
run: | | |
docker pull obolibrary/robot:v1.8.1 | |
# Replace the imports of the UO and PATO ontology .obo files with the equivalent .owl files | |
cp pride_cv.obo tmp_pride.obo | |
cp unimod.obo tmp_unimod.obo | |
sed -e "s/pato.obo/pato.owl/g" -e "s/uo.obo/uo.owl/g" -i tmp_pride.obo | |
sed -e "s/pato.obo/pato.owl/g" -e "s/uo.obo/uo.owl/g" -i tmp_unimod.obo | |
head -n 50 tmp_pride.obo | |
export JAVA_TOOL_OPTIONS=-Xmx6G | |
docker run --rm -v ${{ github.workspace }}:/work obolibrary/robot:v1.8.1 robot convert -vvv -i /work/tmp_pride.obo -o /work/pride_cv.owl --format owl | |
docker run --rm -v ${{ github.workspace }}:/work obolibrary/robot:v1.8.1 robot convert -vvv -i /work/tmp_unimod.obo -o /work/unimod.owl --format owl | |
rm tmp_pride.obo | |
rm tmp_unimod.obo | |
- name: Create pull request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.PRIDE_CV_GITHUB_TOKEN }} | |
commit-message: Update PRIDE OWL file | |
committer: GitHub <[email protected]> | |
author: GitHub <[email protected]> | |
branch: update-owl-file | |
delete-branch: true | |
title: Update OWL file | |
body: This automated PR updates the OWL file corresponding to the OBO file | |
- name: Approve pull request | |
if: (steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated') | |
uses: juliangruber/approve-pull-request-action@v1 | |
with: | |
github-token: ${{ secrets.PRIDE_CV_GITHUB_TOKEN }} | |
number: ${{ steps.cpr.outputs.pull-request-number }} | |
- name: Merge pull request | |
if: (steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated') | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.PRIDE_CV_GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: squash | |
- name: GitHub Tag | |
id: new_tag | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.PRIDE_CV_GITHUB_TOKEN }} | |
pre_release_branches: test-tag | |
custom_tag: ${{ env.CV_VERSION }} |