-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (39 loc) · 1.15 KB
/
check_json_validity.yaml
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
name: Check JSON-LD and JSON files are valid
on:
workflow_dispatch:
push:
branches:
- '**'
paths:
- '**/jsonld-contexts/**'
- '**/ngsild-payloads/**'
jobs:
check-context-valid-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install jq
run: |
sudo apt update && sudo apt install jq
- name: Check JSON and JSON-LD files
run: |
error=0
echo "Checking JSON-LD files"
for file in $(find . -name "*.jsonld"); do
printf "Checking $file .. "
jq empty $file && echo "OK" || { error=1; echo "****************** KO invalid JSON ******************"; }
done
echo ""
echo "Checking JSON files"
for file in $(find . -name "*.json"); do
printf "Checking $file .. "
jq empty $file && echo "OK" || { error=1; echo "****************** KO invalid JSON ******************"; }
done
exit $error
shell: bash
- name: Check JSON files
run: |
error=0
exit $error
shell: bash