fix: run AI catalog sync as standalone script to avoid DB dependency (#18853)

## Summary
- The `ci-ai-catalog-sync` cron workflow was failing because the
`ai:sync-models-dev` NestJS command bootstraps the full app, which tries
to connect to PostgreSQL — unavailable in CI.
- Converted the sync logic to a standalone `ts-node` script
(`scripts/ai-sync-models-dev.ts`) that runs without NestJS, eliminating
the database dependency.
- Removed the `Build twenty-server` step from the workflow since it's no
longer needed, making the job faster.

## Test plan
- [x] Verified the standalone script runs successfully locally via `npx
nx run twenty-server:ts-node-no-deps-transpile-only --
./scripts/ai-sync-models-dev.ts`
- [x] Verified `--dry-run` flag works correctly
- [x] Verified the output `ai-providers.json` is correctly written with
valid JSON (135 models across 5 providers)
- [x] Verified the script passes linting with zero errors
- [ ] CI should pass without requiring a database service

Fixes:
https://github.com/twentyhq/twenty/actions/runs/23424202182/job/68135439740

Made with [Cursor](https://cursor.com)
This commit is contained in:
Félix Malfait
2026-03-23 13:07:53 +01:00
committed by GitHub
parent 2dfa742543
commit c9ca4dfa14
4 changed files with 344 additions and 366 deletions
@@ -1,7 +1,6 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AiSyncModelsDevCommand } from 'src/database/commands/ai-sync-models-dev.command';
import { CronRegisterAllCommand } from 'src/database/commands/cron-register-all.command';
import { DataSeedWorkspaceCommand } from 'src/database/commands/data-seed-dev-workspace.command';
import { ListOrphanedWorkspaceEntitiesCommand } from 'src/database/commands/list-and-delete-orphaned-workspace-entities.command';
@@ -71,7 +70,6 @@ import { AutomatedTriggerModule } from 'src/modules/workflow/workflow-trigger/au
StaleRegistrationCleanupModule,
],
providers: [
AiSyncModelsDevCommand,
DataSeedWorkspaceCommand,
ConfirmationQuestion,
CronRegisterAllCommand,