From 16ad536094566c3458e1f2d2992e17e7d16c69da Mon Sep 17 00:00:00 2001 From: Niv Date: Sat, 27 Jun 2026 15:53:41 +0200 Subject: [PATCH 1/2] fix: workflow to validate JSON files --- .github/workflows/node.js.yml | 60 +++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 6b832f2..cae781c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,25 +1,51 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Verify Data +name: Verify JSON Syntax on: - push: - branches: [ "master" ] pull_request: - branches: [ "master" ] + branches: ["master"] jobs: - build: - + validate-json: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - - run: npm install - - run: node cli.js verify-quest-data - - run: node cli.js verify-hideout-data + - uses: actions/checkout@v4 + + - name: Find and validate all JSON files + run: | + echo "🔍 Scanning repository for JSON files..." + ERRORS=0 + FILES=0 + + while IFS= read -r -d '' file; do + FILES=$((FILES + 1)) + if python3 -c "import json, sys; json.load(open(sys.argv[1]))" "$file" 2>/dev/null; then + echo "$file" + else + echo "INVALID JSON: $file" + python3 -c " + import json, sys + try: + json.load(open(sys.argv[1])) + except json.JSONDecodeError as e: + print(f' Error: {e}') + " "$file" + ERRORS=$((ERRORS + 1)) + fi + done < <(find . -name "*.json" \ + -not -path "./.git/*" \ + -not -path "./node_modules/*" \ + -print0) + + echo "" + echo "──────────────────────────────────" + echo "Scanned : $FILES file(s)" + echo "Errors : $ERRORS file(s)" + echo "──────────────────────────────────" + + if [ "$ERRORS" -gt 0 ]; then + echo "::error::$ERRORS JSON file(s) failed validation." + exit 1 + else + echo "All JSON files are valid." + fi From edfd70a9a46fe6db04d12066267281268c6f77a4 Mon Sep 17 00:00:00 2001 From: Niv Date: Sat, 27 Jun 2026 15:56:14 +0200 Subject: [PATCH 2/2] fix: improve JSON validation output formatting --- .github/workflows/node.js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index cae781c..0cf9783 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,14 +13,14 @@ jobs: - name: Find and validate all JSON files run: | - echo "🔍 Scanning repository for JSON files..." + echo "Scanning repository for JSON files..." ERRORS=0 FILES=0 while IFS= read -r -d '' file; do FILES=$((FILES + 1)) if python3 -c "import json, sys; json.load(open(sys.argv[1]))" "$file" 2>/dev/null; then - echo "$file" + echo "- $file" else echo "INVALID JSON: $file" python3 -c "