From b0de69b1d9aaab938bf2700348a05e7a4e3362fb Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 18 Mar 2026 23:01:15 +0000 Subject: [PATCH] Fix TinaCloud schema sync: force re-index before build The root cause of the schema mismatch was skipIfSchemaCurrent=true in TinaCMS's syncProject() call, which caused TinaCloud to skip re-indexing when it thought the schema SHA hadn't changed. This left TinaCloud with a stale GraphQL schema missing the pages collection (PagesSeo type). Fix: add an explicit curl step before the build that calls TinaCloud's reset endpoint WITHOUT skipIfSchemaCurrent, forcing a full re-index. Keep --skip-cloud-checks in the build command to avoid the circular dependency (build failing because TinaCloud is still indexing). Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/deploy.yml | 16 ++++++++++++++++ package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9f586ec..7a0e63f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,22 @@ jobs: cache: npm - run: npm ci + + - name: Force TinaCloud schema re-index + run: | + echo "Triggering TinaCloud schema refresh..." + curl -s -X POST \ + "https://content.tinajs.io/db/${TINA_PUBLIC_CLIENT_ID}/reset/main?refreshSchema=true" \ + -H "X-API-KEY: ${TINA_TOKEN}" \ + -H "Content-Type: application/json" \ + -o /tmp/tina-reset.json + cat /tmp/tina-reset.json + echo "Waiting 60s for TinaCloud to re-index..." + sleep 60 + env: + TINA_PUBLIC_CLIENT_ID: ${{ secrets.TINA_PUBLIC_CLIENT_ID }} + TINA_TOKEN: ${{ secrets.TINA_TOKEN }} + - run: npm run build env: TINA_PUBLIC_CLIENT_ID: ${{ secrets.TINA_PUBLIC_CLIENT_ID }} diff --git a/package.json b/package.json index 4dec62b..4107839 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "tinacms dev -c \"vite\"", - "build": "tinacms build && node scripts/sync-blog.mjs && node scripts/copy-pages.mjs && node scripts/generate-sitemap.mjs && tsc -b && vite build && node scripts/prerender.mjs", + "build": "tinacms build --skip-cloud-checks && node scripts/sync-blog.mjs && node scripts/copy-pages.mjs && node scripts/generate-sitemap.mjs && tsc -b && vite build && node scripts/prerender.mjs", "lint": "eslint .", "preview": "vite preview", "sync-blog": "node scripts/sync-blog.mjs",