Fix: POS Only Products appearing in the web store #335
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 POT file | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.php' | |
workflow_dispatch: | |
jobs: | |
update-pot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP with tools | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.3' | |
tools: composer, wp-cli | |
- name: Install dependencies | |
run: | | |
wp package install wp-cli/i18n-command:2.2.8 | |
- name: Update POT file | |
run: wp i18n make-pot . languages/woocommerce-pos.pot --domain=woocommerce-pos --slug=woocommerce-pos --package-name="WooCommerce POS" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/wcpos/woocommerce-pos/issues\"}" | |
- name: Check for changes | |
id: git-diff | |
run: | | |
# Extract the current and previous versions of the .pot file | |
git show HEAD:languages/woocommerce-pos.pot > old.pot | |
tail -n +16 languages/woocommerce-pos.pot > new-trimmed.pot | |
tail -n +16 old.pot > old-trimmed.pot | |
# Compare the trimmed files | |
if diff old-trimmed.pot new-trimmed.pot; then | |
echo "No changes detected." | |
else | |
echo "::set-output name=changes::true" | |
fi | |
# Clean up temporary files | |
rm old.pot new-trimmed.pot old-trimmed.pot | |
- name: Commit updated POT file | |
if: steps.git-diff.outputs.changes == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'chore(i18n): update languages/woocommerce-pos.pot' | |
file_pattern: '*.pot' | |