Skip to content

Commit 5f4146d

Browse files
committed
IMPROVEMENT: Only create a PR if .po files changed
1 parent 8ee534a commit 5f4146d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/i18n-extract.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
env:
1515
PYGETTEXT_DOMAIN: ardupilot_methodic_configurator
1616
PYGETTEXT_LOCALEDIR: ardupilot_methodic_configurator/locale
17+
PO_FILES_CHANGED: false
1718

1819
steps:
1920
- uses: actions/checkout@v4
@@ -48,7 +49,14 @@ jobs:
4849
if [ $CHANGED_LINES -gt 4 ]; then
4950
git commit -m "CHORE: Extracted i18n strings to $PYGETTEXT_LOCALEDIR/$PYGETTEXT_DOMAIN.pot"
5051
git push
52+
5153
python merge_pot_file.py
54+
# Check if any .po files were modified
55+
git add $PYGETTEXT_LOCALEDIR/**/$PYGETTEXT_DOMAIN.po
56+
PO_CHANGES=$(git status --porcelain | grep -E "\.po$" | wc -l)
57+
if [ $PO_CHANGES -gt 0 ]; then
58+
echo "PO_FILES_CHANGED=true" >> $GITHUB_ENV
59+
fi
5260
else
5361
echo "Not enough changes to commit (only $CHANGED_LINES lines changed)"
5462
fi
@@ -57,6 +65,7 @@ jobs:
5765
fi
5866
5967
- name: Create Pull Request
68+
if: env.PO_FILES_CHANGED == 'true'
6069
uses: peter-evans/create-pull-request@v5
6170
with:
6271
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)