Skip to content

Generate POT file

Generate POT file #1

Workflow file for this run

name: Generate POT file
on:
workflow_dispatch:
jobs:
WP_POT_Generator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Wordpress POT Generation
shell: bash
run: |
THEME_ROOT="/home/runner/work/cocoon/cocoon"
SAVE_FULL_PATH="$THEME_ROOT/$SAVE_DIR/$DOMAIN.pot"
# Download WP CLI
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/bin/wp
# Regenerate POT file
# wp i18n make-pot "$THEME_ROOT" "$SAVE_FULL_PATH" --domain="$DOMAIN" --exclude="languages/*,plugins/*,blocks/dist/*,node_modules/*" --skip-audit
wp i18n make-pot "$THEME_ROOT" "$SAVE_FULL_PATH" --domain="$DOMAIN" --include="blocks/src/*,lib/*,functions.php,comments.php,searchform.php" --skip-audit --ignore-domain
git config user.name "GitHub Action"
git config user.email "github.action@noreply.com"
git add $SAVE_FULL_PATH
DIFF_COUNT=$(git diff --cached --numstat | wc -l)
if [ $DIFF_COUNT -ne 0 ]; then
git commit -m "POT Regenerated"
git push
fi
env:
SAVE_DIR: 'languages'
DOMAIN: 'cocoon'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}