Skip to content

Electrochemistry terms michael goette #92

Electrochemistry terms michael goette

Electrochemistry terms michael goette #92

Workflow file for this run

# This action runs when a pull request to main is created or updated
# (but not when it is merged into main).
name: CI on pull request create or update
on:
pull_request_target:
branches:
- main
types: [opened, edited, synchronize]
workflow_dispatch:
env:
FORCE_COLOR: "1" # Make tool output pretty.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_PROGRESS_BAR: "off"
LOGLEVEL: "DEBUG"
RUN_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
jobs:
build_vocab:
name: Merge & build vocabulary
# Run on all pull request types except merge which has its own workflow.
if: ${{ !github.event.pull_request.merged }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
# Give the default GITHUB_TOKEN write permission to commit to the PR branch.
contents: write
steps:
- name: Checkout PR branch into cwd
uses: actions/checkout@v4
with:
# Checkout the fork/head-repository to push changes to the fork.
# Without this the base repository will be checked out and committed to.
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Checkout the branch made in the fork.
ref: ${{ github.head_ref }}
- name: Checkout main branch into directory _main_branch/
uses: actions/checkout@v4
with:
ref: main
path: _main_branch
# This sparse-checkout includes all toplevel files and everything below vocabularies/
sparse-checkout: |
vocabularies/
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -VV
python -m pip install --upgrade pip setuptools wheel
# install tagged version
python -m pip install git+https://github.com/nfdi4cat/[email protected]
# python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@main
# install custom pylode 2.x (adds sorted collections,
# uses URIs as fragment IDs and is git-installable)
python -m pip install git+https://github.com/dalito/[email protected]
# Example for installing from private repo:
# python -m pip install git+https://anon:${{ SECRETS.READ_PAT_VOC4CAT }}@github.com/dalito/voc4cat-tool.git@main
- name: Set dynamic environment variables.
run: |
echo "RUN_DATE=$(date +'%Y-%m-%dT%H%M')" >> $GITHUB_ENV
- name: Run voc4cat (pre-convert checks)
run: |
voc4cat --version
# check inbox file names
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --ci-pre inbox-excel-vocabs/ _main_branch/vocabularies
# check xlsx file(s). If the check fails, write annotated file to outbox.
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --outdir outbox inbox-excel-vocabs/
- name: Run voc4cat (convert)
run: |
# convert file(s) from xlsx in inbox to turtle in outbox
voc4cat convert --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --outdir outbox inbox-excel-vocabs/
- name: Run voc4cat (post-convert checks)
run: |
# check all ttl file(s) in outbox
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log outbox/
# check if vocabulary changes are allowed
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --ci-post _main_branch/vocabularies outbox/
- name: Run voc4cat (build HTML documentation)
run: |
voc4cat docs --logfile outbox/voc4cat.log --force outbox/
- name: Split vocabulary and merge into vocabulary dir (in PR branch)
run: |
voc4cat transform --split --inplace --logfile outbox/voc4cat.log --outdir outbox_new_voc outbox/
merge_vocab --logfile outbox/voc4cat.log outbox_new_voc/ vocabularies/
# copy xlsx to outbox so that the xlsx file is part of the artifact
find inbox-excel-vocabs -name '*.xlsx' -exec cp {} -t outbox/ \;
git status
- name: Store artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: voc4cat-outbox_${{ env.RUN_DATE }}_run${{ GITHUB.RUN_ID }}
path: outbox/
- name: Add/stage vocabulary changes
# Pinning of action managed by dependabot
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d
with:
# glob pattern of files which should be added to the commit
file_pattern: 'vocabularies/\*.ttl'
- name: Remove Excel vocabulary files from inbox
run: |
git rm inbox-excel-vocabs/\*.xlsx || echo "No xlsx files to remove."
git status
- name: Commit vocabulary changes & xlsx cleanup on behalf of PR-author
# Pinning of action managed by dependabot
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d
with:
commit_user_name: voc4cat-CI-bot
commit_message: 'CI: vocabulary update in ${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}/actions/runs/${{ GITHUB.RUN_ID }}'