Sync TiDB Cloud Docs from EN to ZH #68
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: Translation(zh) by AI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| file_names: | |
| description: 'Specify file names to translate (comma-separated list)' | |
| required: false | |
| type: string | |
| default: '' | |
| env: | |
| CN_CLOUD_BRANCH: i18n-zh-release-8.5 | |
| jobs: | |
| translate: | |
| if: github.repository == 'pingcap/docs' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| name: Download translator repo | |
| with: | |
| repository: "pingcap/docs-toolkit" | |
| ref: "main" | |
| path: "docs-toolkit" | |
| - uses: actions/checkout@v4 | |
| name: Download docs repo and specified branch | |
| with: | |
| ref: "${{ env.CN_CLOUD_BRANCH }}" | |
| path: "docs" | |
| - uses: actions/setup-node@v4 | |
| name: Setup node | |
| with: | |
| node-version: 20 | |
| - run: | | |
| sudo apt install tree -y | |
| - name: Download files | |
| uses: pingcap/docs-toolkit/actions/file-diff-update@main | |
| with: | |
| config_file: latest_translation_commit.json | |
| working_directory: docs | |
| filter_by_cloud_toc: 'true' | |
| files: ${{ inputs.file_names }} | |
| - name: Show tmp directory structure | |
| run: | | |
| cd docs | |
| tree tmp || find tmp -type f | head -20 | |
| - name: Config and translate | |
| run: | | |
| cd docs-toolkit/markdown-translator | |
| yarn | |
| cd ../.. | |
| export LANGLINK_ACCESS_KEY=${{ secrets.LANGLINK_ACCESS_KEY }} | |
| export LANGLINK_ACCESS_SECRET=${{ secrets.LANGLINK_ACCESS_SECRET }} | |
| export LANGLINK_USER=${{ secrets.LANGLINK_USER }} | |
| node docs-toolkit/markdown-translator/src/index.js --input-dir docs/tmp --output-dir docs/ | |
| - name: Set build ID | |
| id: build_id | |
| run: echo "::set-output name=id::$(date +%s)" | |
| - name: Create PR | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| path: "docs" | |
| token: ${{ github.token }} | |
| branch: zh-translation/${{ steps.build_id.outputs.id }} | |
| base: ${{ env.CN_CLOUD_BRANCH }} | |
| title: "ci: ZH translation ${{ steps.build_id.outputs.id }}" | |
| body: | | |
| ### What is changed, added or deleted? (Required) | |
| Translate docs to Chinese. | |
| ### Which TiDB version(s) do your changes apply to? (Required) | |
| <!-- Fill in "x" in [] to tick the checkbox below.--> | |
| **Tips for choosing the affected version(s):** | |
| By default, **CHOOSE MASTER ONLY** so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, **CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER**. | |
| For details, see [tips for choosing the affected versions](https://github.com/pingcap/docs/blob/master/CONTRIBUTING.md#guideline-for-choosing-the-affected-versions). | |
| - [x] ${{ env.CN_CLOUD_BRANCH }} | |
| ### What is the related PR or file link(s)? | |
| <!--Reference link(s) will help reviewers review your PR quickly.--> | |
| - This PR is translated from: en | |
| - Other reference link(s): | |
| ### Do your changes match any of the following descriptions? | |
| - [ ] Delete files | |
| - [ ] Change aliases | |
| - [ ] Need modification after applied to another branch <!-- If yes, please comment "/label version-specific-changes-required" below to trigger the bot to add the label. --> | |
| - [ ] Might cause conflicts after applied to another branch | |
| delete-branch: true |