fix(scripts): generate-schemas 同時加入 apps/api 和 apps/api/src 到 sys.path
Some checks failed
Type Sync Check / check-type-sync (push) Failing after 56s

問題: CI type-sync-check 持續失敗
原因: 只加 apps/api/src 不夠,模型檔內部用 from src.utils.X import Y
     需要 apps/api 在 path 才能解析 src 套件
結果: 51 個型別全部正確生成

# 2026-04-06 ogt: fix CI type-sync blocking deployment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-06 12:00:18 +08:00
parent f6332b4b2f
commit 8235f91bc6

View File

@@ -22,9 +22,14 @@ import sys
from pathlib import Path
from typing import Any
# 加入 apps/api/src 到 Python path
api_src = Path(__file__).parent.parent / "apps" / "api" / "src"
# 加入 apps/api 和 apps/api/src 到 Python path
# - apps/api/src: script 內部用 `from models.X import Y`
# - apps/api: 模型檔案內部用 `from src.utils.X import Y`
# 2026-04-06 ogt: 兩個都需要,否則跨模組 import 失敗導致 CI 產生空 schema
api_root = Path(__file__).parent.parent / "apps" / "api"
api_src = api_root / "src"
sys.path.insert(0, str(api_src))
sys.path.insert(0, str(api_root))
# 輸出目錄
OUTPUT_DIR = Path(__file__).parent.parent / "packages" / "shared-types" / "schemas"