forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (92 loc) · 3.08 KB
/
generate-readme-translations.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Generate Readme Translations
on:
push:
branches:
- '1222--README-ci-auto-translation'
jobs:
translation:
runs-on: ubuntu-latest
strategy:
matrix:
language:
[
{ code: 'CN', name: 'Chinese' },
{ code: 'DE', name: 'German' },
{ code: 'ES', name: 'Spanish' },
{ code: 'FR', name: 'French' },
{ code: 'HE', name: 'Hebrew' },
{ code: 'IT', name: 'Italian' },
{ code: 'JA', name: 'Japanese' },
{ code: 'KOR', name: 'Korean' },
{ code: 'PTBR', name: 'Portuguese (Brazil)' },
{ code: 'RU', name: 'Russian' },
{ code: 'TH', name: 'Thai' },
{ code: 'TR', name: 'Turkish' },
{ code: 'VI', name: 'Vietnamese' },
{ code: 'AR', name: 'Arabic' },
{ code: 'RS', name: 'Srpski' },
{ code: 'TG', name: 'Tagalog' },
{ code: 'PL', name: 'Polski' },
{ code: 'HU', name: 'Hungarian' },
{ code: 'FA', name: 'Persian' },
{ code: 'RO', name: 'Romanian' },
{ code: 'GR', name: 'Greek' },
{ code: 'NL', name: 'Dutch' },
]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GH_TOKEN }}
- name: Translate to ${{ matrix.language.name }}
uses: 0xjord4n/aixion@v1.2.1
id: aixion
with:
config: >
{
"provider": "openai",
"provider_options": {
"api_key": "${{ secrets.OPENAI_API_KEY }}"
},
"messages": [
{
"role": "system",
"content": "You will be provided with a markdown file in English, and your task is to translate it into ${{ matrix.language.name }}."
},
{
"role": "user",
"content_path": "README.md"
}
],
save_path: "packages/docs/packages/docs/i18n/readme/README_${{ matrix.language.code }}.md",
"model": "gpt-422222o"
}
# Upload each translated file as an artifact
- name: Upload translation
uses: actions/upload-artifact@v4
with:
name: readme-${{ matrix.language.code }}
path: README_${{ matrix.language.code }}.md
commit:
needs: translation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GH_TOKEN }}
# Download all translation artifacts
- name: Download all translations
uses: actions/download-artifact@v4
with:
pattern: readme-*
merge-multiple: true
- name: Commit all translations
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: update all README translations'
branch: main
file_pattern: 'README_*.md'
commit_author: 'GitHub Action <actions@github.com>'