Skip to content

Commit

Permalink
feat: add auto translate readme
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiJiangJie authored and ibuler committed Dec 5, 2024
1 parent ff0f9eb commit a46a81d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/translate-readme.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
name: Translate README.md
name: Translate README
on:
workflow_dispatch:
inputs:
languages:
description: "Target languages"
target_langs:
description: "Target Languages"
required: false
default: "zh-hans,zh-hant,ja,pt-br"
gen_dir_path:
description: "Generate Dir Name"
required: false
default: "readmes/"
push_branch:
description: "Push Branch"
required: false
default: "pr@dev@translate_readme"
prompt:
description: "AI Translate Prompt"
required: false
default: "Do not translate any content under the ‘## License’ section.\nKeep all content, Only delete the first line below [//]: # (Language navigation)."

gpt_mode:
description: "GPT Mode"
required: false
default: "gpt-4o-mini"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Auto Translate
uses: BaiJiangJie/translate-readme@main
with:
gpt_token: ${{ secrets.GPT_API_TOKEN }}
gpt_mode: 'gpt-4o-mini'
target_languages: ${{ github.event.inputs.languages }}
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_TOKEN }}
OPENAI_API_KEY: ${{ secrets.GPT_API_TOKEN }}
GPT_MODE: ${{ github.event.inputs.gpt_mode }}
TARGET_LANGUAGES: ${{ github.event.inputs.target_langs }}
PUSH_BRANCH: ${{ github.event.inputs.push_branch }}
GEN_DIR_PATH: ${{ github.event.inputs.gen_dir_path }}
PROMPT: ${{ github.event.inputs.prompt }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
[![][github-release-shield]][github-release-link]
[![][github-stars-shield]][github-stars-link]

**English** · [简体中文](./README.zh-CN.md)
[//]: # (Language navigation)
**English** · [中文(简体)](./readmes/README.zh-hans.md) · [中文(繁體)](./readmes/README.zh-hant.md) · [日本語](./readmes/README.ja.md) · [Português (Brasil)](./readmes/README.pt-br.md)

</div>
<br/>

Expand Down

0 comments on commit a46a81d

Please sign in to comment.