Merge pull request #1 from davidfurlong/patch-1 #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate JSON Files | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
validate-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install jsonlint | |
run: npm install -g jsonlint | |
- name: Find and Validate JSON Files | |
run: | | |
echo "Finding JSON files..." | |
files=$(find . -type f -name "*.json") | |
if [ -z "$files" ]; then | |
echo "No JSON files found!" | |
exit 0 | |
fi | |
echo "Validating JSON files..." | |
for file in $files; do | |
echo "Validating $file..." | |
jsonlint $file || exit 1 | |
done |