-
Notifications
You must be signed in to change notification settings - Fork 675
37 lines (35 loc) · 1.09 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
name: Json Validator
on:
pull_request:
paths:
- '**.json'
push:
branches:
- main
paths:
- '**.json'
jobs:
json-validator:
name: Json Validator
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Json
run: |
sudo apt-get update
sudo apt-get install python3-venv -y --no-install-recommends
python3 -m venv venv
. venv/bin/activate
pip3 install json-spec
if ! json validate --schema-file=php/containers-schema.json --document-file=php/containers.json; then
exit 1
fi
JSON_FILES="$(find ./community-containers -name '*.json')"
mapfile -t JSON_FILES <<< "$JSON_FILES"
for file in "${JSON_FILES[@]}"; do
json validate --schema-file=php/containers-schema.json --document-file="$file" 2>&1 | tee -a ./json-validator.log
done
if grep -q "document does not validate with schema.\|invalid JSONFile" ./json-validator.log; then
exit 1
fi