58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
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
|
|
|
|
- id: get-short_sha
|
|
uses: actions/github-script@v7.0.1
|
|
with:
|
|
script: |
|
|
const short_sha = context.sha.substring(0, 8)
|
|
core.setOutput('short_sha', short_sha)
|
|
|
|
- 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: 5
|
|
OPENAI_API_KEY: ${{ secrets.DRAGONOS_OPENAI_API_KEY }}
|
|
OPENAI_MODEL: hunyuan-turbos-latest
|
|
OPENAI_BASE_URL: ${{ secrets.DRAGONOS_OPENAI_API_BASE }}
|
|
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
commit-message: "Update translated documentation"
|
|
title: "docs: Translation update [${{steps.get-short_sha.outputs.short_sha}}]"
|
|
body: |
|
|
Automated translation update triggered by docs changes
|
|
Commit: ${{ github.sha }}
|
|
branch: "dragonosbot/docs-translation-update"
|
|
branch-suffix: "timestamp"
|
|
base: ${{ github.ref_name }}
|
|
delete-branch: true
|
|
reviewers: fslongjin
|
|
assignees: fslongjin
|