Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
lint_and_type_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: deploy
name: Deploy to PyPi

# run on merge to master or manual trigger
on:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/translate_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Translate README with Gemini

on:
push:
branches-ignore:
- 'main'
paths:
- 'README.md'
workflow_dispatch:

jobs:
translate:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Read README.md content
id: read_file
uses: jellyfishsdk/read-file-action@v1
with:
path: 'README.md'

- name: Call Gemini API for Translation
id: call_gemini
uses: google-gemini/gemini-api-action@v1
with:
api_key: ${{ secrets.GEMINI_API_KEY }}
prompt: "Please translate the following Markdown text from Traditional Chinese to English. It is for a GitHub project's README file. Preserve all original Markdown formatting, including code blocks, links, tables, and HTML tags. Do not add any extra commentary, introductions, or explanations outside of the translated text itself. Just return the pure, translated Markdown content. Here is the text: ${{ steps.read_file.outputs.content }}"

- name: Update README_ENG.md with translation
run: |
echo "${{ steps.call_gemini.outputs.response }}" > README_ENG.md

- name: Commit and push if changed
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README_ENG.md
if ! git diff --staged --quiet; then
git commit -m "docs: auto-translate README.md to English via Gemini"
git push
else
echo "No changes to commit."
fi