doc: Add Q&A docs (#1174)

* docs: 添加常见问题解答文档并更新工作流配置

- 新增questions目录及构建错误FAQ文档
- 更新文档翻译工作流触发分支为master和doc-*
- 优化PR创建时的提交信息格式

Signed-off-by: longjin <longjin@DragonOS.org>

* ci: 改进文档翻译工作流并添加失败处理

- 添加获取短SHA步骤用于PR标题
- 在翻译脚本中添加失败退出逻辑

Signed-off-by: longjin <longjin@DragonOS.org>

* docs: Translation update [b7b5ea2c] (#1173)

* Update translated documentation
---------

Co-authored-by: dragonosbot <bot@dragonos.org>

* 1

* 1

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dragonosbot <bot@dragonos.org>
This commit is contained in:
LoGin
2025-05-23 02:02:48 +08:00
committed by GitHub
parent 6242ecb2bd
commit ae987c6f9a
9 changed files with 203 additions and 42 deletions

View File

@ -2,55 +2,64 @@ name: Docs Translation
on:
push:
branches: [ master ]
branches: [master]
paths:
- 'docs/**'
- "docs/**"
workflow_dispatch:
jobs:
translate-and-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- 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'
- 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: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- 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: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- 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: 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: 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
- 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: 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 }}
author: bot <bot@dragonos.org>
delete-branch: true
reviewers: fslongjin
assignees: fslongjin