Skip to content

Commit

Permalink
[GitHub Actions] Cleanup untranslated .po files
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jun 8, 2024
1 parent 186ebb3 commit adc3476
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .ci/githubactions/check_po_base_unchanged.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

# Expects input of $1 base file and $2 .po file

diff -q --ignore-trailing-space --ignore-blank-lines \
--ignore-matching-lines='^# .*' \
--ignore-matching-lines='^#$' \
--ignore-matching-lines='^#, fuzzy$' \
--ignore-matching-lines='^".*\:.*"' \
"$1" "$2" &>/dev/null
result=$?

if [ $result -eq 0 ]; then
printf '%s\0' "$2"
fi

exit 0
12 changes: 12 additions & 0 deletions .github/workflows/crowdin_download_translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ jobs:
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

- name: Cleanup untranslated .po files
if: success() && (github.repository == 'Warzone2100/warzone2100')
run: |
# For warzone2100.pot:
find po -name '*.po' -type f \
-exec \
.ci/githubactions/check_po_base_unchanged.sh 'po/warzone2100.pot' '{}' ';' | xargs -r0 -I {} rm "{}"
# For warzone2100_guide.pot:
find po/guide -name '*.po' -type f \
-exec \
.ci/githubactions/check_po_base_unchanged.sh 'po/guide/warzone2100_guide.pot' '{}' ';' | xargs -r0 -I {} rm "{}"
- name: Publish any changes to translations to l10n_master branch
if: success() && (github.repository == 'Warzone2100/warzone2100')
id: pushupdates
Expand Down

0 comments on commit adc3476

Please sign in to comment.