Skip to content

Anchoring: Ability to get detector list from GRPECS (#1452) #2

Anchoring: Ability to get detector list from GRPECS (#1452)

Anchoring: Ability to get detector list from GRPECS (#1452) #2

---
name: Validate JSON syntax
# Run on any commit or PR that changes any JSON file.
'on':
push:
paths:
- '**.json'
pull_request:
paths:
- '**.json'
permissions: {}
jobs:
json-syntax:
name: validate syntax
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate syntax for JSON files
run: |
error=0
readarray -d '' json_files < \
<(find . \( -path ./.git -or -path ./DATA/testing/private \) -prune -false -or -type f -name '*.json' -print0)
for jsonf in "${json_files[@]}"; do
echo "::debug::Checking $jsonf..."
if ! errmsg=$(jq . "$jsonf" 2>&1 >/dev/null); then
error=1
echo "Invalid JSON syntax found in $jsonf:" >&2
printf '::error file=%s,title=%s::%s\n' "$jsonf" 'Invalid JSON syntax' "$errmsg"
fi
done
exit "$error"