From 0f8d05bd22232ad5a52a78acc892e30bd7d2ccfa Mon Sep 17 00:00:00 2001 From: manami-project <13179375+manami-project@users.noreply.github.com> Date: Wed, 1 May 2024 19:48:37 +0200 Subject: [PATCH] Updated entries test --- .github/workflows/json_lint.yml | 73 ++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/.github/workflows/json_lint.yml b/.github/workflows/json_lint.yml index 0836b236a..b86fc9946 100644 --- a/.github/workflows/json_lint.yml +++ b/.github/workflows/json_lint.yml @@ -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' \ No newline at end of file