Skip to content

Update last version changes #525

Update last version changes

Update last version changes #525

# Only PRs into main (the develop → main release and patch releases) need a
# fresh POT; feature PRs into develop don't have to regenerate it.
on:
pull_request:
branches:
- main
name: Translation Template
permissions:
contents: read
jobs:
checkPotIsUpToDate:
name: Check the committed POT matches a fresh build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
tools: composer
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
npm ci
# assets/build is gitignored, so the POT cannot be regenerated correctly
# without building first: `composer pot` reads the built files to record the
# reference WordPress hashes when it looks up JS translations at runtime.
- name: Build assets
run: npm run build:prod
- name: Regenerate the POT
run: composer pot
# POT-Creation-Date is stamped on every run, so it is the one line allowed
# to differ. Anything else means the committed POT is stale — most likely
# regenerated without a build, which silently drops every built-file
# reference and leaves JS strings untranslatable.
- name: Fail if the committed POT is stale
run: |
if ! git diff -I 'POT-Creation-Date' --exit-code -- languages/; then
echo "::error::languages/ is out of date. Run 'npm run build:prod && composer pot' and commit the result."
exit 1
fi