Update workflows #2
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: JSON file validation | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- 'main' | |
push: | |
branches: | |
- main | |
jobs: | |
validate-json: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
- name: Find and validate JSON files | |
run: | | |
# Use find to locate all assessment.json files and validate each one | |
find . -type f -name 'assessment.json' -print0 | while IFS= read -r -d $'\0' json_file; do | |
echo "Validating $json_file" | |
cardinalby/schema-validator-action@v3 --schema schemas/assessment.json --refSchemasMap='{"https://github.com/ASSERT-KTH/lollm//blob/main/schemas/assessment.schema.json": "schemas/assessment.schema.json"}' --file $json_file | |
done | |
- name: Check for validation errors | |
run: | | |
if grep -q "Validation failed" $GITHUB_WORKSPACE/$GITHUB_ACTION_PATH; then | |
echo "Validation failed" | |
exit 1 | |
fi |