-
Notifications
You must be signed in to change notification settings - Fork 53
52 lines (45 loc) · 1.68 KB
/
auto-translation.yaml
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
name: Auto Translation
on:
pull_request:
paths:
- content/english/**
jobs:
auto-translate:
runs-on: ubuntu-latest
continue-on-error: true
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # or the version your project requires
- name: Run Translation Tool
env:
GITHUB_TOKEN: ${{ secrets.MODELS_TOKEN }}
run: |
languages=("french" "spanish" "portuguese" "german" "kyrgyz" "simplified-chinese" "traditional-chinese")
changed_files=$(git diff --name-only -r HEAD^1 HEAD | grep '^content/english/.*/[^/]*\.md$')
for file in $changed_files; do
echo "Translating $file"
for lang in "${languages[@]}"; do
dotnet run --project translation-tool/WorkshopAutoTranslation/WorkShopTranslationV2 -- "$file" "$lang"
done
done
- name: Create Pull Request with AI-Generated Translations
uses: peter-evans/create-pull-request@v4
with:
commit-message: "Add AI translations for new workshops"
title: "[Github Actions] AI Workshop Translations"
body: "This PR contains suggestions for AI translations for new English workshops."
branch: "auto-translation-suggestions"
labels: "translation, auto-generated"
base: "master" # or the default branch of your repository