Repository navigation
feat(ci): 翻译目录自动化——PR 内自动补译 + 每日兜底同步 - #608
Conversation
…stop Source-string changes currently require authors to run the localization pipeline by hand; skipping it fails the catalog completeness check late in review (e.g. #599). Automate the two manual steps with the installed catalog GitHub App: - translate-pr-catalogs.yml: on PRs touching the en-US/zh-CN TS sources or additional JSON, import sources and incrementally translate all 53 target locales, committing catalog diffs back to the PR branch. Same-repository heads only (fork PRs skip), head SHA re-checked before push, and bot commits touch only catalogs/*.json so the workflow cannot retrigger itself. - sync-translation-catalogs.yml: daily + dispatch backstop on main that opens or refreshes an automation/translation-catalogs PR and auto-merges it through the normal required checks, mirroring sync-provider-model-catalog.yml. - scripts/ci/automation-pr.mjs: generalized sole-open-PR selector with fail-closed validation, plus workflow contract tests that execute the shell steps against simulated gh/git. Design contract and plan: docs/design/translation-catalog-automation*.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3600c5ad03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rces The importer resolves the workspace typescript dependency; fresh runners have no node_modules. Install the pinned pnpm store (cached) in both translation workflows ahead of the import step, and assert the ordering in the workflow contract tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fa5113502
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 5fa5113502
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…ll scripts setup-node's pnpm cache resolves pnpm store path, which fails before pnpm exists; mirror ci.yml's pnpm/action-setup ordering. Lifecycle scripts from checked-out code could persist shims through GITHUB_PATH, so install with --ignore-scripts; the importer and translator only need module resolution. Contract tests assert both orderings.
背景
源文案变更后需要作者本地手动跑
catalog:import-legacy+catalog:translate,漏跑就会被翻译完整性检查卡住(#599 的教训)。本 PR 把这两步自动化,方案与实施计划见:改动
translate-pr-catalogs.yml(主链路):PR 改动四个真源文件(两个 TS locale + 两个 additional JSON)时,checkout PR head → 导入 → 增量翻译 53 个语言 → 有 diff 才以 App bot 身份提交推回 PR 分支。catalogs/*.json,不在触发路径内,不会自我循环sync-translation-catalogs.yml(辅链路):每日 03:41 UTC + 手动触发,仅 main;漂移时推送automation/translation-catalogs分支 → 开/更新 PR →--auto --squash --match-head-commit走正常门禁自动合并。结构与模型目录同步完全对齐。scripts/ci/automation-pr.mjs:通用化的"唯一开放自动化 PR"选择器(fail-closed),不动既有provider-model-catalog-pr.mjs。automation-pr.test.mjs+translation-workflows.test.mjs,包含用模拟 gh/git 真实执行工作流 shell 步骤(edit/create/歧义/跨仓库全路径),CI 的 common lane 会自动跑。安全
MODEL_CATALOG_APP_*凭证,不新增 App/secret;内置权限保持contents: read,写权限只在仓库级 App token 的短命凭证里catalog:check(占位符/受保护 token/sourceHash/完整性),门禁标准不变验证
node --test scripts/ci/automation-pr.test.mjs scripts/ci/translation-workflows.test.mjs12 项全绿import-legacy-web-catalogs.mjs在当前 main 上幂等(无 diff)workflow_dispatch空跑兜底链路