diff --git a/.github/workflows/schema-sync-check.yml b/.github/workflows/schema-sync-check.yml new file mode 100644 index 0000000..649e4bc --- /dev/null +++ b/.github/workflows/schema-sync-check.yml @@ -0,0 +1,17 @@ +name: Schema sync check + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: node scripts/check-schema-sync.mjs diff --git a/scripts/check-schema-sync.mjs b/scripts/check-schema-sync.mjs new file mode 100644 index 0000000..fa23020 --- /dev/null +++ b/scripts/check-schema-sync.mjs @@ -0,0 +1,77 @@ +#!/usr/bin/env node +import { readFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import path from 'node:path'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const repoRoot = path.resolve(__dirname, '..'); + +const FILES = ['index.html', 'book.html']; +const SHARED_IDS = [ + 'https://suedeai.ai/founder#person', + 'https://suede-ai.github.io/#website', +]; + +function extractGraph(fileName) { + const html = readFileSync(path.join(repoRoot, fileName), 'utf8'); + const match = html.match(/