-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.54 KB
/
translate.yml
File metadata and controls
61 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Translate Documentation
on:
workflow_dispatch:
inputs:
languages:
description: 'Languages to translate (comma-separated, e.g., "es,fr,de" or "all")'
required: false
default: 'all'
force:
description: 'Force re-translation of all files'
required: false
default: 'false'
type: boolean
debug:
description: 'Enable debug output'
required: false
default: 'false'
type: boolean
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run translation
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }}
run: |
ARGS=""
if [ "${{ inputs.languages }}" != "all" ]; then
ARGS="$ARGS --locales ${{ inputs.languages }}"
fi
if [ "${{ inputs.debug }}" == "true" ]; then
ARGS="$ARGS --debug"
fi
node scripts/translate.js --concurrency 2 --commit $ARGS
- name: Push translations
if: always() && !cancelled()
run: git push