Skip to content

Commit

Permalink
GitHub action for validating info/ schemas
Browse files Browse the repository at this point in the history
Added a GitHub action workflow to convert the yamls in `info/` and
validate them against the schema file in the corresponding directory.
  • Loading branch information
TimothyWillard committed Jan 24, 2025
1 parent 575fd96 commit c8c055c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
paths:
- 'flepimop/gempyor_pkg/**/*.py'
- 'info/**/*'
pull_request:
types:
- edited
Expand All @@ -14,8 +15,10 @@ on:
- synchronize
paths:
- '**/*.py'
- 'info/**/*'
branches:
- main
- dev

jobs:
black-for-python:
Expand Down Expand Up @@ -45,3 +48,38 @@ jobs:
with:
src: ${{ env.BLACK_SRC }}
options: "--line-length ${{ env.BLACK_LINE_LENGTH }} --extend-exclude '${{ env.BLACK_EXTEND_EXCLUDE }}' --check --verbose"
check-info-json-schema:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
sparse-checkout: |
*
!documentation/
sparse-checkout-cone-mode: false
- name: Install yq and check-jsonschema
run: |
sudo apt update
sudo apt install snapd
sudo snap install yq
sudo apt install pipx
pipx install check-jsonschema
- name: Convert YAML to JSON
run: |
cd info
for d in $( ls ); do
cd $d
for y in *.yml; do
yq --output-format json $y > ${y%.yml}.json
done
for j in *.json; do
if [[ "$j" != "schema.json" ]]; then
check-jsonschema --verbose --schemafile schema.json $j
fi
done
cd ..
done
cd ..

0 comments on commit c8c055c

Please sign in to comment.