CI: Implement automated translation workflow for lecture synchronization #188
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.
This PR implements a comprehensive GitHub Actions workflow that automatically detects when lectures are modified in the English repository (
QuantEcon/lecture-python.myst) and migrates those changes to the Chinese repository (QuantEcon/lecture-python.zh-cn) when the lectures have already been translated.Workflow Overview
The system provides a complete automation pipeline:
_toc.ymlto identify which lectures have been translatedKey Components
GitHub Actions Workflow
Python Automation Scripts
check_translation_status.py: Analyzes PR diffs and determines which files need translationcreate_translation_pr.py: Handles AI translation and PR creation with proper branch managementcreate_fallback_issue.py: Creates detailed issues when automation cannot proceedAI Translation Features
Setup Requirements
The workflow requires two repository secrets:
GITHUB_TOKEN: Personal access token with repository permissionsOPENAI_API_KEY: OpenAI API key for translation servicesIntegration with the source repository can be achieved through repository dispatch events or webhooks as documented in
INTEGRATION_EXAMPLE.md.Testing and Validation
Includes comprehensive testing infrastructure:
Example Usage
When a PR modifying
lectures/linear_algebra.mdis opened in the English repository:linear_algebraexists in the Chinese_toc.ymltranslation-update-pr-{number}in the Chinese repositoryIf translation fails or no translated lectures are found, it creates an issue for manual review instead.
This automation significantly reduces the manual overhead of keeping translations synchronized while maintaining quality through AI assistance and human review.
Fixes #187.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.