| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- name: Sync Multi Language
- on:
- workflow_dispatch:
- inputs:
- branchName:
- description: 'Branch Name'
- required: true
- excelName:
- description: 'Excel Name'
- required: true
- sheetName:
- description: 'Sheet Name'
- required: true
- jobs:
- run-script:
- runs-on: ubuntu-latest
- permissions:
- contents: write
- steps:
- - name: Check out code
- uses: actions/checkout@v3
- with:
- ref: ${{ github.event.inputs.branchName }}
- - name: Set up Python 3
- uses: actions/setup-python@v4
- with:
- python-version: '3.x'
- - name: Install dependencies
- run: |
- cd tool/translate
- pip3 install pygsheets
- if [ ! -f requirements.txt ]; then
- echo "No requirements.txt found, installing default dependencies"
- pip install requests pandas
- else
- pip install -r requirements.txt
- fi
- - name: Run Python script
- run: |
- cd tool/translate
- python3 synxml.py -f "${{ github.event.inputs.excelName }}" -t "${{ github.event.inputs.sheetName }}"
- - name: Commit Language Change
- run: |
- git config --global user.email "450468291@qq.com"
- git config --global user.name "GitHub Action"
- git add .
- git commit -m "Update Language" || echo "No changes to commit"
- git push
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #设置GitHub Token
|