Skip to content

Commit

Permalink
[GitHub Actions] Tweak Crowdin workflows [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Apr 20, 2024
1 parent 105f2b6 commit d76814f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .ci/githubactions/crowdin_download_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Output the filenames that have actual modifications, ignoring certain .po file header lines
# Note: Requires GNU Diffutils
diff --brief --recursive --unified=1 --new-file \
--ignore-matching-lines='^"POT-Creation-Date: .*"' \
--ignore-matching-lines='^"PO-Revision-Date: .*"' \
--ignore-matching-lines='^"Last-Translator: .*"' \
"$@" \
| cut -d' ' -f 2 | sed "s#$1*##"

exit 0
9 changes: 7 additions & 2 deletions .github/workflows/crowdin_download_translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>"
git add -A
# Add modified files (ignoring po header modifications):
git difftool --dir-diff --extcmd=.ci/githubactions/crowdin_download_diff.sh | xargs -0 git add
# Add untracked (new) files:
git ls-files --others --exclude-standard | xargs -0 git add
echo "Debug output:"
git status
echo "Commit changes:"
git commit -m "New Crowdin translations" || { echo "PROCESS_PR=false" >> $GITHUB_OUTPUT && exit 0; }
echo "Pushing changes to l10n_master branch"
git push -f origin master:l10n_master
Expand All @@ -74,7 +80,6 @@ jobs:
- name: Create Pull Request to update translations (if needed)
if: success() && (github.repository == 'Warzone2100/warzone2100') && (steps.pushupdates.outputs.PROCESS_PR == 'true')
id: cpr
working-directory: '${{ github.workspace }}/master'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
Expand Down

0 comments on commit d76814f

Please sign in to comment.