diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 8ef50d1..aac728f 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -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: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4cd8ca6..3691337 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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: diff --git a/.github/workflows/translate_readme.yml b/.github/workflows/translate_readme.yml new file mode 100644 index 0000000..04f6dec --- /dev/null +++ b/.github/workflows/translate_readme.yml @@ -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 \ No newline at end of file