-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (41 loc) · 1.15 KB
/
validate-json.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
#name: Validate JSON
#on:
# push:
# branches:
# - main # Ou a branch que deseja monitorar
#jobs:
# validate-json:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Validate JSON
# run: |
# if jq -e .field_to_check $GITHUB_WORKSPACE/path/to/your/json.json > /dev/null; then
# echo "Field 'field_to_check' exists."
# else
# echo "Field 'field_to_check' does not exist."
# exit 1
# fi
#
name: Validate JSON
on: [push, pull_request]
jobs:
validate-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install jq
run: sudo apt-get install jq
- name: Validate JSON files
run: |
# Encontra todos os arquivos JSON e os valida
find . -type f -name '*.json' -print0 | while IFS= read -r -d '' file; do
echo "Validating $file"
jq empty "$file" || { echo "Invalid JSON: $file"; exit 1; }
done