fix(ci): enable branch smoke tests and shift migration trigger to health check
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Build & Deploy / 🧪 QA (push) Successful in 3m22s
Build & Deploy / 🏗️ Build (push) Successful in 5m2s
Build & Deploy / 🚀 Deploy (push) Successful in 28s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 4m14s
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-03-05 12:08:49 +01:00
parent fe3cb37351
commit 42c287f519
3 changed files with 10 additions and 7 deletions

View File

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

View File

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

View File

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