Skip to content

Commit 9c1fbe3

Browse files
pattonwebzclaude
andcommitted
Drop the WordPress and MySQL scaffolding from make-pot
`wp i18n make-pot` is static analysis over the source tree: it parses PHP/JS for translation calls and writes a .pot. It never bootstraps WordPress and never touches a database. Verified by running it against this plugin on a machine with no WordPress, no MySQL and no wp-config.php - exit 0. So the mysql:5.7 service, the readiness loop, the wordpress.org tarball download, the wp-config sed, `wp core install`, and the copy into wp-content/plugins and back out were all satisfying a dependency that does not exist. wp-cli now comes from setup-php's `tools:`, replacing the apt PHP install and the phar download. The xdebug.max_nesting_level line went with it: that apt line never installed xdebug, and `coverage: none` keeps it off. make-pot still runs against dist/accessibility-checker exactly as before, so the generated POT is unchanged. It writes to $RUNNER_TEMP rather than into the plugin copy only because the committed dist copy is the baseline the next step diffs against. No behaviour change otherwise: same triggers, same `base` input, same PR targeting, same single .pot in add-paths. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
1 parent 473bd77 commit 9c1fbe3

1 file changed

Lines changed: 16 additions & 54 deletions

File tree

.github/workflows/make-pot.yml

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ jobs:
2525
)
2626
)
2727
runs-on: ubuntu-latest
28-
services:
29-
mysql:
30-
image: mysql:5.7
31-
env:
32-
MYSQL_ROOT_PASSWORD: root
33-
MYSQL_DATABASE: wordpress
34-
ports:
35-
- 3306:3306
36-
options: >-
37-
--health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
3828
steps:
3929
- name: Checkout code
4030
uses: actions/checkout@v4
@@ -60,56 +50,28 @@ jobs:
6050
- name: Build plugin (dotorg dist)
6151
run: npm run dist:dotorg
6252

63-
- name: Install PHP and required extensions
64-
run: |
65-
sudo apt-get update && sudo apt-get install -y php php-mysql php-xml php-curl
66-
echo "xdebug.max_nesting_level=1024" | sudo tee -a /etc/php/$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')/cli/conf.d/20-xdebug.ini
67-
68-
- name: Download wp-cli
69-
run: |
70-
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
71-
chmod +x wp-cli.phar
72-
sudo mv wp-cli.phar /usr/local/bin/wp
73-
74-
- name: Download and configure WordPress
75-
run: |
76-
curl -O https://wordpress.org/latest.tar.gz
77-
tar -xzf latest.tar.gz
78-
cp -r dist/accessibility-checker wordpress/wp-content/plugins/accessibility-checker
79-
cp wordpress/wp-config-sample.php wordpress/wp-config.php
80-
sed -i \
81-
-e "s/database_name_here/wordpress/" \
82-
-e "s/username_here/root/" \
83-
-e "s/password_here/root/" \
84-
-e "s/'DB_HOST', 'localhost'/'DB_HOST', '127.0.0.1:3306'/" \
85-
wordpress/wp-config.php
86-
echo "define('FS_METHOD', 'direct');" >> wordpress/wp-config.php
87-
88-
- name: Wait for MySQL to be ready
89-
run: |
90-
for i in {1..30}; do
91-
if mysqladmin ping -h127.0.0.1 -uroot -proot --silent; then
92-
break
93-
fi
94-
sleep 2
95-
done
96-
97-
- name: Install WordPress
98-
run: |
99-
cd wordpress
100-
wp core install --url=localhost --title=Test --admin_user=admin --admin_password=admin --admin_email=admin@example.com --skip-email --allow-root
53+
# `wp i18n make-pot` is static analysis over the source tree, so it needs
54+
# neither a database nor an installed WordPress.
55+
- name: Set up PHP with wp-cli
56+
uses: shivammathur/setup-php@v2
57+
with:
58+
php-version: '8.2'
59+
tools: wp-cli
60+
coverage: none
10161

62+
# Written to a temp path so the committed copy inside dist/ survives as
63+
# the comparison baseline for the next step.
10264
- name: Generate POT file
10365
run: |
104-
cd wordpress/wp-content/plugins/accessibility-checker
105-
wp i18n make-pot . ./languages/accessibility-checker.pot --allow-root
66+
cd dist/accessibility-checker
67+
wp i18n make-pot . "${RUNNER_TEMP}/accessibility-checker.pot"
10668
10769
- name: Check if POT file changed (ignoring some headers)
10870
id: pot_diff
10971
run: |
110-
if [ -f wordpress/wp-content/plugins/accessibility-checker/languages/accessibility-checker.pot ] && [ -f dist/accessibility-checker/languages/accessibility-checker.pot ]; then
72+
if [ -f "${RUNNER_TEMP}/accessibility-checker.pot" ] && [ -f dist/accessibility-checker/languages/accessibility-checker.pot ]; then
11173
diff_output=$(diff \
112-
<(grep -vE '^("?(POT-Creation-Date|PO-Revision-Date|X-Generator|Project-Id-Version):|#|$)' wordpress/wp-content/plugins/accessibility-checker/languages/accessibility-checker.pot) \
74+
<(grep -vE '^("?(POT-Creation-Date|PO-Revision-Date|X-Generator|Project-Id-Version):|#|$)' "${RUNNER_TEMP}/accessibility-checker.pot") \
11375
<(grep -vE '^("?(POT-Creation-Date|PO-Revision-Date|X-Generator|Project-Id-Version):|#|$)' dist/accessibility-checker/languages/accessibility-checker.pot) || true)
11476
if [ -n "$diff_output" ]; then
11577
echo "pot_changed=true" >> $GITHUB_OUTPUT
@@ -137,7 +99,7 @@ jobs:
13799
uses: actions/upload-artifact@v4
138100
with:
139101
name: accessibility-checker-i18n
140-
path: wordpress/wp-content/plugins/accessibility-checker/languages/accessibility-checker.pot
102+
path: ${{ runner.temp }}/accessibility-checker.pot
141103

142104
- name: Set up Git for PR
143105
if: steps.pot_diff.outputs.pot_changed == 'true'
@@ -148,7 +110,7 @@ jobs:
148110
- name: Copy updated POT file to languages folder
149111
if: steps.pot_diff.outputs.pot_changed == 'true'
150112
run: |
151-
cp wordpress/wp-content/plugins/accessibility-checker/languages/accessibility-checker.pot ./languages/accessibility-checker.pot
113+
cp "${RUNNER_TEMP}/accessibility-checker.pot" ./languages/accessibility-checker.pot
152114
153115
- name: Create or Update Pull Request with updated POT file
154116
if: steps.pot_diff.outputs.pot_changed == 'true'

0 commit comments

Comments
 (0)