Skip to content

Commit

Permalink
Updated entries test
Browse files Browse the repository at this point in the history
  • Loading branch information
manami-project committed May 1, 2024
1 parent 64494bf commit 0f8d05b
Showing 1 changed file with 41 additions and 32 deletions.
73 changes: 41 additions & 32 deletions .github/workflows/json_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,52 @@ on:
- '.github/CONTRIBUTING.md'

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node environment
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install jsonlint
run: npm install jsonlint -g
- name: Check anime-offline-database.json
run: jsonlint -q anime-offline-database.json
- name: Check anime-offline-database-minified.json
run: jsonlint -q anime-offline-database-minified.json
- name: Check dead-entries for anidb.json
run: jsonlint -q dead-entries/anidb.json
- name: Check dead-entries for anidb-minified.json
run: jsonlint -q dead-entries/anidb-minified.json
- name: Check dead-entries for anilist.json
run: jsonlint -q dead-entries/anilist.json
- name: Check dead-entries for anilist-minified.json
run: jsonlint -q dead-entries/anilist-minified.json
- name: Check dead-entries for kitsu.json
run: jsonlint -q dead-entries/kitsu.json
- name: Check dead-entries for kitsu-minified.json
run: jsonlint -q dead-entries/kitsu-minified.json
- name: Check dead-entries for myanimelist.json
run: jsonlint -q dead-entries/myanimelist.json
- name: Check dead-entries for myanimelist-minified.json
run: jsonlint -q dead-entries/myanimelist-minified.json
- name: Validate dataset using JSON schema
uses: cardinalby/schema-validator-action@v3
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
outputs:
run_schema_validation: ${{ steps.check_message.outputs.run_schema_validation }}
dataset-validation:
needs: check-commit-message
runs-on: ubuntu-latest
steps:
- name: Debug
run: echo "${{ needs.check-commit-message.outputs.run_schema_validation }}"
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
if: ${{ needs.check-commit-message.outputs.run_schema_validation == 'true' }}
with:
file: 'anime-offline-database.json|anime-offline-database-minified.json'
schema: 'schema.json'
- name: Validate dead-entries files using JSON schema
uses: cardinalby/schema-validator-action@v3
dead-entries-validation:
needs: check-commit-message
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
if: ${{ needs.check-commit-message.outputs.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'
schema: 'dead-entries/schema.json'

0 comments on commit 0f8d05b

Please sign in to comment.