This repository was archived by the owner on Oct 18, 2025. It is now read-only.
New translations from Crowdin (#202) #13
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: Download new translations from Crowdin | |
| on: | |
| schedule: | |
| - cron: 0 21 * * * #every day at 9pm | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| download: | |
| name: Download translations | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| branch: [ stable ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| - name: Download translations | |
| uses: crowdin/github-action@v2 | |
| with: | |
| upload_sources: false | |
| upload_translations: false | |
| download_translations: true | |
| create_pull_request: false | |
| push_translations: false | |
| export_only_approved: true #irrespective of project config, only accept approved translations here | |
| crowdin_branch_name: ${{ matrix.branch }} | |
| env: | |
| CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
| CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
| - name: Post-process placeholders back into PocketMine format | |
| run: | | |
| sed -i -r 's/\{([A-Za-z0-9]+)\}/\{%\1\}/g' *.ini | |
| git diff | |
| git status | |
| - name: Delete translation files with no translations | |
| run: | | |
| for file in *.ini; do | |
| if grep -q -P '^[A-Za-z0-9_\-\.]+=' $file; then | |
| echo "Not empty: $file" | |
| else | |
| echo "Deleting empty file: $file" | |
| rm "$file" | |
| fi | |
| done | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| add-paths: '*.ini' | |
| commit-message: 'New translations from Crowdin' | |
| branch: crowdin-auto-fetch/${{ matrix.branch }} | |
| title: 'New translations from Crowdin' | |
| base: ${{ matrix.branch }} |