Add voice index validation script #9
This file contains hidden or 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 Voice Index JSON | |
| on: | |
| pull_request: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install validator deps | |
| run: | | |
| npm init -y | |
| npm i -D ajv ajv-formats | |
| - name: JSON parse check (only these 2 files) | |
| run: | | |
| node - <<'NODE' | |
| const fs = require("fs"); | |
| const files = [ | |
| "registry/voice-index.json/packs/union-budget-2026-27/part-a-core-budget-concepts-2026.json", | |
| "registry/voice-index.json/packs/union-budget-2026-27/part-b-budget-public-finance-fiscal-language.json" | |
| ]; | |
| let ok = true; | |
| for (const f of files) { | |
| if (!fs.existsSync(f)) { | |
| console.error("❌ Missing file:", f); | |
| ok = false; | |
| continue; | |
| } | |
| try { | |
| JSON.parse(fs.readFileSync(f, "utf8")); | |
| console.log("✅ Parsed:", f); | |
| } catch (e) { | |
| console.error("❌ Invalid JSON:", f, e.message); | |
| ok = false; | |
| } | |
| } | |
| if (!ok) process.exit(1); | |
| NODE |