📦 datapack-function-library: 发布 v2.0.0 版本 #90
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Translate | |
| on: | |
| push: | |
| paths: | |
| - 'Localization-Resource-Pack/assets/**' | |
| workflow_dispatch: | |
| inputs: | |
| force_translate: | |
| description: 'Force translate all languages' | |
| required: false | |
| default: false | |
| type: boolean | |
| non_thinking_mode: | |
| description: 'Use non-thinking mode' | |
| required: false | |
| default: false | |
| type: boolean | |
| translation_debug: | |
| description: 'Enable per-request debug logs' | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| translate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: Create translate directory | |
| run: | | |
| mkdir -p translate | |
| - name: Run translation script | |
| env: | |
| DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} | |
| FORCE_TRANSLATE: ${{ github.event.inputs.force_translate || 'false' }} | |
| NON_THINKING_MODE: ${{ github.event.inputs.non_thinking_mode || 'false' }} | |
| TRANSLATION_DEBUG: ${{ github.event.inputs.translation_debug || 'false' }} | |
| run: | | |
| python .github/scripts/translate.py | |
| - name: Upload translation logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: translation-logs | |
| path: | | |
| translation.log | |
| .github/scripts/logs/ | |
| retention-days: 30 | |
| - name: Commit and push changes | |
| run: | | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git config --local pull.rebase false | |
| git add translate/ | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-translate: Update translation files" | |
| git pull origin ${{ github.ref_name }} | |
| git push origin ${{ github.ref_name }} | |
| fi |