Add zh-cn translation sync workflow (Phase 0 Track B)#979
Conversation
Wires this repo as the source for QuantEcon/lecture-python.zh-cn: on each merged lecture PR (or a \translate-resync comment), the action translates the changed lectures and opens a PR in the target repo. Copied from lecture-python-intro's proven workflow with only the target-repo changed. Part of Phase 0 Track B (#947). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a GitHub Actions workflow to automatically sync (translate) changed lecture content from this English source repository into the QuantEcon/lecture-python.zh-cn target repository when PRs merge (or when manually re-triggered via a \translate-resync comment).
Changes:
- Introduces a new workflow triggered on merged PRs affecting lecture Markdown /
_toc.yml. - Adds an
issue_commenttrigger intended to allow manual resync via\translate-resync. - Runs
QuantEcon/action-translationinsyncmode targetingQuantEcon/lecture-python.zh-cn.
| if: > | ||
| (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || | ||
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '\translate-resync')) |
There was a problem hiding this comment.
Fixed in 8abdb57 — the issue_comment path now requires the comment to be on a PR (github.event.issue.pull_request), contain the command, and come from a trusted author (author_association in OWNER/MEMBER/COLLABORATOR). Also being propagated to the upstream template and the sibling source-sync workflows (intro, programming), which share this shape — tracked in action-translation.
| with: | ||
| fetch-depth: 2 | ||
|
|
||
| - uses: QuantEcon/action-translation@v0 |
There was a problem hiding this comment.
Declining this one deliberately: floating @v0 is the program's settled pin policy (decision of record 2026-07-18, QuantEcon/project-translation#9). It is the action's own documented convention, and exact pins demonstrably starved repos of needed fixes — v0.17.0's typography fix sat unreachable behind nine exact pins while live syncs kept stripping non-breaking spaces. The 0.x-may-break risk is mitigated where it matters: every sync lands as a PR a human reviews before merge. (Also, latest is v0.20.0, not v0.17.0.)
| issue_comment: | ||
| types: [created] | ||
|
|
||
| jobs: |
There was a problem hiding this comment.
Fixed in 8abdb57 — added job-level permissions: contents: read. The action authenticates with QUANTECON_SERVICES_PAT via its github-token input, so the ambient GITHUB_TOKEN is unused beyond checkout; read-only is sufficient. Also headed for the upstream template.
📖 Netlify Preview Ready!Preview URL: https://pr-979--sunny-cactus-210e3e.netlify.app Commit: Build Info
|
|
Pre-merge verification per QuantEcon/project-translation#14 step 3 (2026-07-22): Pin — Shape — byte-identical to the proven source-sync template in Secrets — both org secrets are visible to this repo (verified via the repo's organization-secrets API): Target readiness — lecture-python.zh-cn is fully prepared: drift reconciled and merged (#188–#193), metadata bootstrap merged (#195), corpus verified at 84 aligned + 37 source-only with zero outdated and zero missing heading-maps, review/rebase workflows live on Ready to merge. Once in, the first organic lecture merge (or a |
…issions Copilot review: the issue_comment trigger ran a secrets-bearing job for any comment containing the command, from any user, on any issue. Now requires a PR comment from OWNER/MEMBER/COLLABORATOR. Adds permissions: contents: read since the action authenticates via QUANTECON_SERVICES_PAT, not GITHUB_TOKEN. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Part of #947. Wires this repo as the English source for QuantEcon/lecture-python.zh-cn: on each merged lecture PR (or a
\translate-resynccomment) the action translates the changed lectures and opens a PR in the target repo. Copied from lecture-python-intro's proven workflow with only the target-repo changed; pinsQuantEcon/action-translation@v0.Secrets: ANTHROPIC_API_KEY and QUANTECON_SERVICES_PAT are already org-visible to this repo (verified 2026-07-18).
Decision note for merge time: 42 of 121 lectures have no translation yet. Once this workflow is live, a merged source PR touching an untranslated lecture will open a new-translation PR in the target — effectively incremental Phase 2 without a restarted review campaign. If that is not wanted yet, hold this PR until the campaign scoping (see the Track B editor report in project-translation) is settled, or merge and triage new-file PRs as they appear; each arrives as a reviewable PR either way.
🤖 Generated with Claude Code