doc_translation.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Docs Translation
  2. on:
  3. push:
  4. branches: [master]
  5. paths:
  6. - "docs/**"
  7. workflow_dispatch:
  8. jobs:
  9. translate-and-pr:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout code
  13. uses: actions/checkout@v3
  14. with:
  15. fetch-depth: 0
  16. - id: get-short_sha
  17. uses: actions/github-script@v7.0.1
  18. with:
  19. script: |
  20. const short_sha = context.sha.substring(0, 8)
  21. core.setOutput('short_sha', short_sha)
  22. - name: Set up Python
  23. uses: actions/setup-python@v5
  24. with:
  25. python-version: "3.10"
  26. - name: Install dependencies
  27. run: |
  28. python -m pip install --upgrade pip
  29. pip install -r docs/requirements.txt
  30. - name: Run document translator
  31. run: python tools/doc_translator.py
  32. env:
  33. MAX_WORKERS: 5
  34. OPENAI_API_KEY: ${{ secrets.DRAGONOS_OPENAI_API_KEY }}
  35. OPENAI_MODEL: hunyuan-turbos-latest
  36. OPENAI_BASE_URL: ${{ secrets.DRAGONOS_OPENAI_API_BASE }}
  37. - name: Create Pull Request
  38. uses: peter-evans/create-pull-request@v5
  39. with:
  40. commit-message: "Update translated documentation"
  41. title: "docs: Translation update [${{steps.get-short_sha.outputs.short_sha}}]"
  42. body: |
  43. Automated translation update triggered by docs changes
  44. Commit: ${{ github.sha }}
  45. branch: "dragonosbot/docs-translation-update"
  46. branch-suffix: "timestamp"
  47. base: ${{ github.ref_name }}
  48. author: bot <bot@dragonos.org>
  49. delete-branch: true
  50. reviewers: fslongjin
  51. assignees: fslongjin