Implement github action to lint and validate JSON files #2
This file contains hidden or 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: JSON Schema Validation | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
validate-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install sourcemeta json schema cli | |
uses: sourcemeta/jsonschema@main | |
- name: Lint JSON files | |
run: | | |
echo "Linting softbinding-algorithm-entry-schema.json..." | |
set -e # Exit on any error | |
jsonschema lint softbinding-algorithm-entry-schema.json | |
echo "✓ softbinding-algorithm-entry-schema.json passed linting" | |
- name: Validate against schema | |
run: | | |
echo "Validating softbinding-algorithm-list.json against schema..." | |
set -e # Exit on any error | |
jsonschema validate softbinding-algorithm-list.json --schema softbinding-algorithm-entry-schema.json | |
echo "✓ softbinding-algorithm-list.json is valid against the schema" |