-
Notifications
You must be signed in to change notification settings - Fork 15
45 lines (40 loc) · 1.04 KB
/
validate-json.yml
File metadata and controls
45 lines (40 loc) · 1.04 KB
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
name: Validate JSON
on:
pull_request:
branches:
- main
paths:
- 'pricing/**'
- 'general/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Pricing JSON
run: |
echo "Validating pricing/*.json files..."
ERRORS=0
for file in pricing/*.json; do
if ! jq empty "$file"; then
echo "::error file=$file::Invalid JSON syntax in $file"
ERRORS=$((ERRORS + 1))
fi
done
if [ $ERRORS -gt 0 ]; then
exit 1
fi
- name: Validate General JSON
run: |
echo "Validating general/*.json files..."
ERRORS=0
for file in general/*.json; do
if ! jq empty "$file"; then
echo "::error file=$file::Invalid JSON syntax in $file"
ERRORS=$((ERRORS + 1))
fi
done
if [ $ERRORS -gt 0 ]; then
exit 1
fi