From 6242ecb2bde5e40b0bef8315b6db0f5dcbc1a0bf Mon Sep 17 00:00:00 2001 From: LoGin Date: Thu, 22 May 2025 15:09:37 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E7=9A=84GitHub=20Actions=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=20(#1171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: 添加文档翻译的GitHub Actions工作流 新增了用于自动翻译文档的GitHub Actions工作流 Signed-off-by: longjin --------- Signed-off-by: longjin --- .github/workflows/doc_translation.yml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/doc_translation.yml diff --git a/.github/workflows/doc_translation.yml b/.github/workflows/doc_translation.yml new file mode 100644 index 00000000..1462cc96 --- /dev/null +++ b/.github/workflows/doc_translation.yml @@ -0,0 +1,56 @@ +name: Docs Translation + +on: + push: + branches: [ master ] + paths: + - 'docs/**' + workflow_dispatch: + +jobs: + translate-and-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r docs/requirements.txt + + - name: Run document translator + run: python tools/doc_translator.py + env: + MAX_WORKERS: 20 + OPENAI_API_KEY: ${{ secrets.DRAGONOS_OPENAI_API_KEY }} + OPENAI_MODEL: Qwen/Qwen3-8B + OPENAI_BASE_URL: ${{ secrets.DRAGONOS_OPENAI_API_BASE }} + + - name: Commit translated files + run: | + git config --global user.name "dragonosbot" + git config --global user.email "bot@dragonos.org" + git add docs/locales/ + git commit -m "Update translated documentation" || echo "No changes to commit" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "Update translated documentation" + title: "docs: Automatic translation update" + body: "Automated translation update triggered by docs changes" + branch: "dragonosbot/docs-translation-update" + branch-suffix: "timestamp" + base: master + author: dragonosbot + delete-branch: true + reviewers: fslongjin + assignees: fslongjin