mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 21:42:27 +08:00
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
name: Auto I18N
|
|
|
|
env:
|
|
API_KEY: ${{ secrets.TRANSLATE_API_KEY}}
|
|
MODEL: ${{ vars.MODEL || 'deepseek/deepseek-v3.1'}}
|
|
BASE_URL: ${{ vars.BASE_URL || 'https://api.ppinfra.com/openai'}}
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
auto-i18n:
|
|
runs-on: ubuntu-latest
|
|
name: Auto I18N
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: 🐈⬛ Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
|
|
- name: 📦 Setting Node.js and Yarn
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: 📦 Enable Yarn Corepack
|
|
run: corepack enable
|
|
|
|
- name: 📦 Install only required dependencies
|
|
run: |
|
|
mkdir -p temp-deps
|
|
cd temp-deps
|
|
echo '{"dependencies": {"openai": "^5.12.2", "cli-progress": "^3.12.0", "tsx": "^4.20.3"}}' > package.json
|
|
npm install --no-package-lock
|
|
cd ..
|
|
ln -sf temp-deps/node_modules .
|
|
|
|
- name: 🏃♀️ Translate
|
|
run: yarn run tsx scripts/update-i18n.ts
|
|
|
|
- name: 🔄 Commit changes
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git add .
|
|
git reset -- package.json yarn.lock # 不提交 package.json 和 yarn.lock 的更改
|
|
git commit -m "fix(i18n): Auto update translations for PR #${{ github.event.pull_request.number }}"
|
|
|
|
- name: 🚀 Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ github.event.pull_request.head.ref }}
|