IMPROVEMENT: pylint fixes #14
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: 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 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install requirements | |
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 | |
else | |
echo "Not enough changes to commit (only $CHANGED_LINES lines changed)" | |
fi | |
else | |
echo "No changes to commit" | |
fi |