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 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-18 23:01:15 +00:00
parent 9146ebfbf0
commit b0de69b1d9
2 changed files with 17 additions and 1 deletions

View file

@ -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 }}

View file

@ -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",