-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtranslate-readme.yml
More file actions
92 lines (76 loc) · 2.51 KB
/
translate-readme.yml
File metadata and controls
92 lines (76 loc) · 2.51 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
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
name: Translate README
on:
push:
branches:
- main
- master
paths:
- "README.md"
permissions:
contents: write
pull-requests: write
models: read
jobs:
translate:
runs-on: ubuntu-latest
strategy:
matrix:
language: ["spanish", "chinese"]
include:
- language: "spanish"
file: "README.es.md"
- language: "chinese"
file: "README.zh.md"
steps:
- uses: actions/checkout@v5
- name: Translate README
uses: actions/ai-inference@v2
id: translate
with:
max-tokens: 2000
system-prompt: |
You are a highly skilled ${{ matrix.language }} translator.
## Your Responsibilities
- Translate the provided text to ${{ matrix.language }}
- Detect the source language automatically
- Return only the translation, no explanations or notes
## Input
You will receive the text to translate in the user message.
## Translation Rules
- Preserve the meaning, tone, formatting, structure, and style of the original text
- Keep technical terms, code blocks, and code examples in their original form
- Keep URLs, file paths, and image references unchanged
prompt-file: README.md
- name: Save translation
run: |
mkdir -p docs
echo "$TRANSLATED_TEXT" | tee docs/${{ matrix.file }}
env:
TRANSLATED_TEXT: ${{ steps.translate.outputs.response }}
- name: Upload translation artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file }}
path: docs/${{ matrix.file }}
create-pr:
needs: translate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
path: docs
merge-multiple: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "docs: update translations of README"
title: "docs: update translations of README"
body: |
This PR updates all translations of the README:
Changes were automatically generated using the [ai-inference](https://github.com/actions/ai-inference) action.
branch: docs/update-readme-translations
add-paths: "docs/README*"
delete-branch: true
labels: |
documentation