Skip to content

feat: Add automated translation sync workflow with DeepSeek API#876

Open
comfyui-wiki wants to merge 3 commits intomainfrom
feat/auto-translation-sync
Open

feat: Add automated translation sync workflow with DeepSeek API#876
comfyui-wiki wants to merge 3 commits intomainfrom
feat/auto-translation-sync

Conversation

@comfyui-wiki
Copy link
Copy Markdown
Member

Summary

  • Adds a GitHub Actions workflow that triggers on push to main when English .mdx files change
  • Automatically detects which language translations are out of sync (skips files already updated in the same commit)
  • Translates only the changed sections (diff-based, split by headings) to minimize API cost and preserve existing translations
  • Creates a PR for human review — never commits directly to main

How it works

  1. On push to main, detect changed English .mdx files
  2. For each file × language, check if the translation was already updated in the same commit
  3. If not → call DeepSeek API to translate only the changed sections
  4. Open a new PR (i18n/sync-<sha>) with all translated files

Adding a new language

Edit .github/scripts/translation-config.json and add an entry:

{ "code": "fr", "name": "French", "dir": "fr", "snippets_dir": "snippets/fr" }

Setup required

Add DEEPSEEK_API_KEY as a repository secret in GitHub Settings → Secrets.

Test plan

  • Add DEEPSEEK_API_KEY secret to the repo
  • Merge a small English .mdx change to main and verify a translation PR is created
  • Verify that files already updated in the same PR are skipped
  • Verify the translation label is applied to the generated PR

🤖 Generated with Claude Code

- .github/workflows/translation-sync.yml: triggers on push to main,
  detects which language files are out of sync, runs translation script,
  creates a PR for review
- .github/scripts/translate-sync.py: diff-based translation — only
  translates changed sections (split by headings), skips files already
  updated in the same commit
- .github/scripts/translation-config.json: language config, easily
  extensible to add new languages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown
Contributor

mintlify bot commented Mar 29, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
comfy 🟢 Ready View Preview Mar 29, 2026, 4:43 PM

…fixes

- Use section index position instead of heading text to match sections
  between English and translated files (language-agnostic)
- Fix language dir: zh-CN → zh, snippets/zh
- Fix workflow: use step output for branch name instead of env var
- Fix workflow: use gh pr create body inline to avoid heredoc issues
- Add .env to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant