Synchronous Translation #134
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: Synchronous Translation | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| synchronous-translation: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'Ada18980/KinkiestDungeon' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install git+https://github.com/MuXiu1997/ParaTranz-SDK-python.git | |
| pip install requests | |
| - name: 🚀 Run synchronous-translation script | |
| env: | |
| PARATRANZ_TOKEN: ${{ secrets.PARATRANZ_TOKEN }} | |
| run: python .github/scripts/synchronous-translation-script.py | |
| - name: 📂 Merge translations | |
| run: | | |
| PATH_PARATRANZ="Screens/MiniGame/KinkyDungeon/Text_KinkyDungeon_CN_paratranz.txt" | |
| PATH_ORIGIN="Screens/MiniGame/KinkyDungeon/Text_KinkyDungeon_CN.txt" | |
| PATH_TEMP=$(mktemp) | |
| cat "$PATH_ORIGIN" > "$PATH_TEMP" | |
| printf "\n\n" >> "$PATH_TEMP" | |
| cat "$PATH_PARATRANZ" >> "$PATH_TEMP" | |
| mv "$PATH_TEMP" "$PATH_ORIGIN" | |
| python .github/scripts/format-translation-script.py --translation_files Screens/MiniGame/KinkyDungeon/Text_KinkyDungeon_CN.txt | |
| - name: 📝 Commit changes | |
| id: check_changes | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "synchronous-translation-action" | |
| git add "Screens/MiniGame/KinkyDungeon/Text_KinkyDungeon_CN.txt" | |
| git diff-index --quiet HEAD || git commit -m "Synchronous translation files" | |
| git push |