Restructure docs: move intro and quickstart to framework #4
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: AI Translate Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'content/docs/**/*.mdx' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| translate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v44 | |
| with: | |
| files: content/docs/**/*.mdx | |
| separator: "," | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8 | |
| - name: Install dependencies | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: pnpm install | |
| - name: Run translation script | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| env: | |
| # 需要在 GitHub 仓库 Settings > Secrets 中配置 OPENAI_API_KEY | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| # 如果使用兼容 OpenAI 接口的其他模型(如 DeepSeek, Azure),可配置 Base URL 和 Model | |
| OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} | |
| OPENAI_MODEL: "gpt-4o" | |
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: pnpm translate | |
| - name: Create Pull Request | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "docs: auto-translate updates to zh-CN" | |
| title: "🤖 Auto Translate: Sync zh-CN docs" | |
| body: | | |
| This PR automatically syncs the Chinese documentation with the latest English changes. | |
| Triggered by changes in: | |
| ${{ steps.changed-files.outputs.all_changed_files }} | |
| branch: "auto-translate/patch-${{ github.run_id }}" | |
| base: "main" | |
| labels: "documentation, automated-pr" |