Skip to content

CHORE: Bump version info, tag and release #26

CHORE: Bump version info, tag and release

CHORE: Bump version info, tag and release #26

Workflow file for this run

name: Extract i18n Strings
on:
push:
branches:
- master
paths:
- '**/*.py'
- '!**/tests/**'
jobs:
extract_strings:
runs-on: ubuntu-latest
env:
PYGETTEXT_DOMAIN: ardupilot_methodic_configurator
PYGETTEXT_LOCALEDIR: ardupilot_methodic_configurator/locale
PO_FILES_CHANGED: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install apt gettext package
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Install python-gettext requirement
run: |
python -m pip install --upgrade pip python-gettext
- name: Extract strings
run: |
pygettext3 -d $PYGETTEXT_DOMAIN -o $PYGETTEXT_LOCALEDIR/$PYGETTEXT_DOMAIN.pot $(git ls-files '*.py') || exit 1
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add $PYGETTEXT_LOCALEDIR/$PYGETTEXT_DOMAIN.pot
if [ -n "$(git status --porcelain)" ]; then
CHANGED_LINES=$(git diff --staged | grep -E "^[\+\-]" | wc -l)
if [ $CHANGED_LINES -gt 4 ]; then
git commit -m "CHORE: Extracted i18n strings to $PYGETTEXT_LOCALEDIR/$PYGETTEXT_DOMAIN.pot"
git push
python merge_pot_file.py
# Check if any .po files were modified
git add $PYGETTEXT_LOCALEDIR/**/$PYGETTEXT_DOMAIN.po
PO_CHANGES=$(git status --porcelain | grep -E "\.po$" | wc -l)
if [ $PO_CHANGES -gt 0 ]; then
echo "PO_FILES_CHANGED=true" >> $GITHUB_ENV
fi
else
echo "Not enough changes to commit (only $CHANGED_LINES lines changed)"
fi
else
echo "No changes to commit"
fi
- name: Create Pull Request
if: env.PO_FILES_CHANGED == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: merge-i18n-po-strings
title: "chore(deps): merge translation string(s) to existing .po files"
commit-message: "chore(deps): merge translation string(s) to existing .po files"
body: |
Update .po files with string(s) from the .pot file