mirror of
https://github.com/fastapi/fastapi.git
synced 2026-07-01 10:36:36 -04:00
👷 Update LLM translation CI, add language matrix and extra commands, prepare for scheduled run (#14529)
This commit is contained in:
committed by
GitHub
parent
4414cd849d
commit
2e7aaea524
46
.github/workflows/translate.yml
vendored
46
.github/workflows/translate.yml
vendored
@@ -16,7 +16,7 @@ on:
|
||||
- update-outdated
|
||||
- add-missing
|
||||
- update-and-add
|
||||
- remove-all-removable
|
||||
- remove-removable
|
||||
language:
|
||||
description: Language to translate to as a letter code (e.g. "es" for Spanish)
|
||||
type: string
|
||||
@@ -32,9 +32,42 @@ env:
|
||||
UV_SYSTEM_PYTHON: 1
|
||||
|
||||
jobs:
|
||||
job:
|
||||
if: github.repository_owner == 'fastapi'
|
||||
langs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
langs: ${{ steps.show-langs.outputs.langs }}
|
||||
commands: ${{ steps.show-langs.outputs.commands }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
cache-dependency-glob: |
|
||||
requirements**.txt
|
||||
pyproject.toml
|
||||
- name: Install Dependencies
|
||||
run: uv pip install -r requirements-github-actions.txt -r requirements-translations.txt
|
||||
- name: Export Language Codes
|
||||
id: show-langs
|
||||
run: |
|
||||
echo "langs=$(python ./scripts/translate.py llm-translatable-json)" >> $GITHUB_OUTPUT
|
||||
echo "commands=$(python ./scripts/translate.py commands-json)" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
LANGUAGE: ${{ github.event.inputs.language }}
|
||||
COMMAND: ${{ github.event.inputs.command }}
|
||||
|
||||
translate:
|
||||
if: github.repository_owner == 'fastapi'
|
||||
needs: langs
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
lang: ${{ fromJson(needs.langs.outputs.langs) }}
|
||||
command: ${{ fromJson(needs.langs.outputs.commands) }}
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
@@ -50,8 +83,6 @@ jobs:
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
cache-dependency-glob: |
|
||||
requirements**.txt
|
||||
pyproject.toml
|
||||
@@ -68,10 +99,11 @@ jobs:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
- name: FastAPI Translate
|
||||
run: |
|
||||
python ./scripts/translate.py ${{ github.event.inputs.command }}
|
||||
python ./scripts/translate.py ${{ matrix.command }}
|
||||
python ./scripts/translate.py make-pr
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.FASTAPI_TRANSLATIONS }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LANGUAGE: ${{ github.event.inputs.language }}
|
||||
LANGUAGE: ${{ matrix.lang }}
|
||||
EN_PATH: ${{ github.event.inputs.en_path }}
|
||||
COMMAND: ${{ matrix.command }}
|
||||
|
||||
Reference in New Issue
Block a user