Adjust diff mechanism

This commit is contained in:
Philipp 2021-04-10 14:36:39 +02:00
parent 7eaa5d7727
commit fcc3d028a9
No known key found for this signature in database
GPG Key ID: 9A28B7D4FF5667BD

View File

@ -1,9 +1,9 @@
name: Check Transifex name: Transifex
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
messages: messages:
name: Check message.po changes name: Check messages.po changes
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install gettext - name: Install gettext
@ -15,15 +15,16 @@ jobs:
- name: Run Xgettext - name: Run Xgettext
run: ./bin/run_xgettext.sh run: ./bin/run_xgettext.sh
- name: Commit changed message.po - name: Check if messages.po needs an update
run: | run: |
git config --local user.email "workflow@github.com" echo "::group::Check messages.po"
git config --local user.name "GitHub Workflow" # Skip first 4 lines in possible diff, because they're header
git add ./view/lang/C/messages.po # Skip all lines of the git diff starting with "@@" or comments or starting "POT-Creation-Date"
git commit -m "Update message.po" || echo "Nothing to update" if [[ $(git diff -U0 ./view/lang/C/messages.po | awk '!/@@|-"POT-Creation-Date|+"POT-Creation-Date|-#|+#/{print }' | wc -l) > 4 ]]; then
echo "::error file=messages.po::messages.po is out of date"
- name: Push changes exit 1
uses: ad-m/github-push-action@master else
with: echo "Nothing to update"
github_token: ${{ secrets.GITHUB_TOKEN }} fi
branch: ${{ github.ref }} echo "::endgroup::"
shell: bash