Update updates.md #37
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
| name: Translate Docs | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/src/en/**' | |
| # The English contributing page is an mdbook include of this file, so a | |
| # change here must regenerate docs/src/es/contributing.md (see translate_docs.py). | |
| - 'CONTRIBUTING.md' | |
| workflow_dispatch: | |
| # Only one translation run at a time; new pushes cancel in-progress runs. | |
| concurrency: | |
| group: translate-docs | |
| cancel-in-progress: true | |
| jobs: | |
| translate: | |
| runs-on: ubuntu-latest | |
| # Skip commits made by this workflow to avoid loops. | |
| if: "!contains(github.event.head_commit.message, '[skip translate]')" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # full history so git diff works | |
| token: ${{ secrets.TRAFFIC_ACTION_TOKEN }} # PAT so the push triggers deploy.yml | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install anthropic | |
| - name: Run translation | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| BEFORE_SHA: ${{ github.event.before }} | |
| AFTER_SHA: ${{ github.sha }} | |
| run: python .github/scripts/translate_docs.py | |
| - name: Commit and push translations | |
| run: | | |
| if [ -z "$(git status --porcelain docs/src/es/)" ]; then | |
| echo "No Spanish doc changes to commit." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add docs/src/es/ | |
| git commit -m "Auto-translate Spanish docs [skip translate]" | |
| git pull --rebase origin main | |
| git push |