From 42c287f519db969586983eca1404b8f5bc2bfd77 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 5 Mar 2026 12:08:49 +0100 Subject: [PATCH] fix(ci): enable branch smoke tests and shift migration trigger to health check --- .gitea/workflows/deploy.yml | 2 +- app/api/health/cms/route.ts | 10 +++++++++- payload.config.ts | 5 ----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 1fc2c71f..ea348178 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -436,7 +436,7 @@ jobs: post_deploy_checks: name: 🧪 Post-Deploy Verification needs: [prepare, deploy] - if: needs.deploy.result == 'success' && needs.prepare.outputs.target != 'branch' + if: needs.deploy.result == 'success' && true runs-on: docker container: image: catthehacker/ubuntu:act-latest diff --git a/app/api/health/cms/route.ts b/app/api/health/cms/route.ts index c247e36a..f8c51112 100644 --- a/app/api/health/cms/route.ts +++ b/app/api/health/cms/route.ts @@ -16,6 +16,14 @@ export async function GET() { const payload = await getPayload({ config: configPromise }); checks.init = 'ok'; + // Ensure migrations are applied on startup (reliable for standalone builds) + try { + await payload.db.migrate(); + } catch (e: any) { + console.error('Migration failed:', e.message); + // We continue to check the collections even if migration fails + } + // Verify each collection can be queried (catches missing locale tables, broken migrations) const collections = ['posts', 'products', 'pages', 'media'] as const; for (const collection of collections) { @@ -27,7 +35,7 @@ export async function GET() { } } - const hasErrors = Object.values(checks).some(v => v.startsWith('error')); + const hasErrors = Object.values(checks).some((v) => v.startsWith('error')); return NextResponse.json( { status: hasErrors ? 'degraded' : 'ok', checks }, { status: hasErrors ? 503 : 200 }, diff --git a/payload.config.ts b/payload.config.ts index c4879b28..289ba29c 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -28,14 +28,9 @@ const dirname = path.dirname(filename); export default buildConfig({ onInit: async (payload) => { - payload.logger.info('Payload onInit hook started'); if (process.env.NODE_ENV === 'production') { - payload.logger.info('Running automated migrations...'); - await payload.db.migrate(); - payload.logger.info('Seeding database...'); await seedDatabase(payload); } - payload.logger.info('Payload onInit hook finished'); }, admin: { user: Users.slug,