-
Notifications
You must be signed in to change notification settings - Fork 86
71 lines (69 loc) · 2.44 KB
/
json_lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
outputs:
run_schema_validation: ${{ steps.check_message.outputs.run_schema_validation }}
dataset-validation:
needs: check-commit-message
if: ${{ needs.check-commit-message.outputs.run_schema_validation == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
with:
file: 'anime-offline-database.json'
schema: 'anime-offline-database.schema.json'
dataset-minified-validation:
needs: check-commit-message
if: ${{ needs.check-commit-message.outputs.run_schema_validation == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
with:
file: 'anime-offline-database-minified.json'
schema: 'anime-offline-database-minified.schema.json'
dead-entries-validation:
needs: check-commit-message
if: ${{ needs.check-commit-message.outputs.run_schema_validation == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cardinalby/schema-validator-action@v3
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/dead-entries.schema.json'