forked from rdkcentral/rdkservices
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (39 loc) · 1.16 KB
/
json_validator.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
name: json-validator
on:
push:
branches: [ main, 'sprint/**', 'release/**' ]
pull_request:
branches: [ main, 'sprint/**', 'release/**' ]
jobs:
build:
runs-on: ubuntu-latest
name: Validate json files
steps:
- uses: actions/checkout@v3
- name: Get modified/added json files
id: json-files
uses: tj-actions/changed-files@v19
with:
files: |
**/*.json
- name: Validate the json files
id: validate-json-files
run : |
failed_jsons=()
FAILED=false
for file in ${{ steps.json-files.outputs.all_changed_files }}; do
echo "Validating the json file $file"
if ! python -m json.tool $file
then
FAILED=true
echo "Json schema error in $file"
failed_jsons+=("$file")
continue
fi
done
if [ $FAILED == true ]
then
echo "Error in parsing the JSON"
echo "Failed jsons are ${failed_jsons[@]}"
exit 1
fi