fix(l10n): update mmex.pot (#7078) #77
This file contains 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: Update mmex.pot translation template | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-po-template: | |
if: github.repository_owner == 'moneymanagerex' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install gettext | |
run: sudo apt-get install -y gettext | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: l10n | |
- name: Execute update script | |
run: | | |
: # merge master | |
git config --global user.name 'MMEX' | |
git config --global user.email '[email protected]' | |
git config pull.rebase false | |
git fetch origin | |
git merge origin/master --allow-unrelated-histories --strategy-option theirs | |
: # run the po update script | |
bash util/update-po-files.sh | |
: # add the new template to a commit and check if there are any changes | |
git add po/mmex.pot | |
echo "CHANGES"="$(git diff --shortstat --cached | awk '{print $4 + $6}')" >> $GITHUB_ENV | |
echo $CHANGES | |
- name: Commit changes | |
if: ${{ env.CHANGES > 2 }} | |
run: | | |
git commit -m "fix(l10n): update mmex.pot" | |
git push | |
- name: Check for open pull request | |
if: ${{ env.CHANGES > 2 }} | |
run: | | |
echo "OPEN_PR"="$(gh pr list --state open -H l10n --json headRefName -q '.[].headRefName' | grep -c "l10n")" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create pull request | |
if: ${{ env.CHANGES > 2 && env.OPEN_PR == 0 }} | |
run: | | |
gh pr create -B master -H l10n --title "fix(l10n): update mmex.pot" --body 'Updated PO translation template via GitHub Action' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |