mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 14:16:47 +00:00
ci: 添加文档翻译的GitHub Actions工作流 (#1171)
* ci: 添加文档翻译的GitHub Actions工作流 新增了用于自动翻译文档的GitHub Actions工作流 Signed-off-by: longjin <longjin@DragonOS.org> --------- Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
parent
b397190fea
commit
6242ecb2bd
56
.github/workflows/doc_translation.yml
vendored
Normal file
56
.github/workflows/doc_translation.yml
vendored
Normal file
@ -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 <dragonosbot@dragonos.org>
|
||||||
|
delete-branch: true
|
||||||
|
reviewers: fslongjin
|
||||||
|
assignees: fslongjin
|
Loading…
x
Reference in New Issue
Block a user