Files
PocketMine-MP/resources/translations/.github/workflows/download-translations.yml
Dylan K. Taylor 25e1feadd8 Add 'resources/translations/' from commit '822b73086d50f4dc5eb938d30f29349d10f91c70'
git-subtree-dir: resources/translations
git-subtree-mainline: ca332588b8
git-subtree-split: 822b73086d
2025-10-18 13:36:04 +01:00

62 lines
1.7 KiB
YAML

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 }}