Add nightly workflow to auto-translate stale zh files - #5522
Merged
Merged
Conversation
When English source MDX files are updated, any corresponding zh translation files become stale and will reference content that may no longer exist (broken images, removed components, etc.). This workflow triggers on push to main when fern/products/**/*.mdx files change, detects zh translation files for the changed EN pages, and removes them. Fern's localization system then falls back to auto-translating from the current EN source for those pages. This prevents the broken links issue that PR #5515 fixed, where stale zh translations referenced images/components that EN had since replaced.
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
3 tasks
Uses Anthropic Claude API to re-translate stale zh translation files when EN source changes, rather than deleting them. This preserves pre-computed translations and avoids the cost of on-the-fly translation at build/serve time. Requires ANTHROPIC_API_KEY to be set as a GitHub Actions secret.
…als: false Addresses two zizmor security findings: 1. Pin actions/setup-python to commit hash (unpinned action reference) 2. Add persist-credentials: false to checkout (credential persistence) 3. Use explicit GITHUB_TOKEN for push step instead of persisted credentials
Runs at 6 AM UTC daily instead of on every push to main. Uses git commit timestamps to detect stale zh translations (EN source has a newer commit than the zh file) rather than comparing HEAD~1. Full repo history (fetch-depth: 0) is needed for timestamp comparison.
devalog
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a GitHub Actions workflow (
sync-translations.yml) that runs nightly at 6 AM UTC to detect and re-translate stale zh translation files.Problem: zh translations were created as point-in-time snapshots (PR #5203). When EN source pages are updated, the zh translations become stale — referencing content that no longer exists (broken images, removed components, outdated instructions). See PR #5515 for the current batch of 101 stale files.
How it works:
workflow_dispatchfor manual runs)This preserves pre-computed translations (avoiding on-the-fly translation cost at build/serve time) while keeping them automatically in sync with EN content.
Requires:
ANTHROPIC_API_KEYGitHub Actions secret.Review & Testing Checklist for Human
ANTHROPIC_API_KEYis available as a GitHub Actions secret (or add it)workflow_dispatchafter merging to verify the translation pipeline works end-to-endNotes
This is the "missing trigger" identified while investigating #5515. The translation infrastructure in fern-platform works correctly — the issue was that no CI process kept zh translation files in sync when EN source changed.
Uses
fetch-depth: 0for full git history to compare commit timestamps accurately.See also: #5515 (fixes the current 101 stale translations)
Link to Devin session: https://app.devin.ai/sessions/14ca348f182f4957985bb57cd50e0031