Skip to content

Add nightly workflow to auto-translate stale zh files - #5522

Merged
devalog merged 4 commits into
mainfrom
devin/1778844638-sync-stale-translations
May 15, 2026
Merged

devalog merged 4 commits into
mainfrom
devin/1778844638-sync-stale-translations

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

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:

  1. Runs nightly at 6 AM UTC (also supports workflow_dispatch for manual runs)
  2. For each zh translation file, compares git commit timestamps with its EN counterpart
  3. If the EN source has a newer commit than the zh translation, the translation is stale
  4. Re-translates stale files using the Anthropic Claude API
  5. Commits and pushes the updated translations

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_KEY GitHub Actions secret.

Review & Testing Checklist for Human

  • Verify ANTHROPIC_API_KEY is available as a GitHub Actions secret (or add it)
  • Review the translation system prompt to ensure it matches your quality expectations
  • Test with workflow_dispatch after merging to verify the translation pipeline works end-to-end

Notes

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: 0 for 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

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.
@devin-ai-integration
devin-ai-integration Bot requested a review from devalog as a code owner May 15, 2026 11:31
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Comment thread .github/workflows/sync-translations.yml Fixed
@github-actions

Copy link
Copy Markdown
Contributor

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.
@devin-ai-integration devin-ai-integration Bot changed the title Add workflow to auto-remove stale zh translations when EN source changes Add workflow to auto-translate stale zh files when EN source changes May 15, 2026
Comment thread .github/workflows/sync-translations.yml Fixed
…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.
@devin-ai-integration devin-ai-integration Bot changed the title Add workflow to auto-translate stale zh files when EN source changes Add nightly workflow to auto-translate stale zh files May 15, 2026
@devalog
devalog merged commit 317941e into main May 15, 2026
3 checks passed
@devalog
devalog deleted the devin/1778844638-sync-stale-translations branch May 15, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants