Skip to content

Conditionally run schema validation #632

Conditionally run schema validation

Conditionally run schema validation #632

Workflow file for this run

name: Check JSON files
on:
push:
branches:
- '**'
paths-ignore:
- 'README.md'
- '.gitignore'
- '.gitattributes'
- '.github/ISSUE_TEMPLATE/**/*'
- '.github/CONTRIBUTING.md'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install jsonlint-cli -g
- name: Lint dataset
run: jsonlint-cli *.json
- name: Lint dead-entries
run: jsonlint-cli dead-entries/*.json
check-commit-message:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check commit message
id: check_message
run: |
MESSAGE=$(git log --format=%B -n 1 ${{ github.event.after }})
if [[ "$MESSAGE" == "Updated entries"* ]]; then
echo "run_schema_validation=true" >> $GITHUB_OUTPUT
else
echo "run_schema_validation=false" >> $GITHUB_OUTPUT
fi
dataset-validation:
needs: check-commit-message
runs-on: ubuntu-latest
steps:
- name: Debug
run: echo "fromJSON(env.GITHUB_OUTPUT).run_schema_validation"
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
if: ${{ fromJSON(env.GITHUB_OUTPUT).run_schema_validation == 'true'

Check failure on line 48 in .github/workflows/json_lint.yml

View workflow run for this annotation

GitHub Actions / Check JSON files

Invalid workflow file

The workflow is not valid. .github/workflows/json_lint.yml (Line: 48, Col: 13): The expression is not closed. An unescaped ${{ sequence was found, but the closing }} sequence was not found. .github/workflows/json_lint.yml (Line: 58, Col: 13): The expression is not closed. An unescaped ${{ sequence was found, but the closing }} sequence was not found.
with:
file: 'anime-offline-database.json|anime-offline-database-minified.json'
schema: 'schema.json'
dead-entries-validation:
needs: check-commit-message
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
if: ${{ fromJSON(env.GITHUB_OUTPUT).run_schema_validation == 'true'
with:
file: 'dead-entries/anidb.json|dead-entries/anidb-minified.json|dead-entries/anilist.json|dead-entries/anilist-minified.json|dead-entries/kitsu.json|dead-entries/kitsu-minified.json|dead-entries/myanimelist.json|dead-entries/myanimelist-minified.json'
schema: 'dead-entries/schema.json'