Update: October 2026 – You don’t need the dev packages in your action
A while back I wrote about using WP-CLI in your GitHub actions for translating plugin releases. It worked! I’ve been using it ever since. But it turns out I was making my GitHub action do a lot more work than it needed to.
In that version, the action ran composer install with all the dev packages for exactly one reason: so wp i18n make-pot would exist when it was time to generate the .pot file. For me that meant PHPCS, code standards and related sniffs, and a bunch of Symfony components, all downloaded just to scan some strings.
I didn’t mind because it worked and because my plugins didn’t include any required packages for production, but it got sillier once I started requiring a production-facing composer package as then I needed Composer to install everything twice, once composer install --no-dev and then later composer install. Le sigh.
So here’s the leaner version: one Composer install per release, and it’s the production one.
Step 1: Keep your makepot Composer script
Nothing changes here. You still want wp-cli/i18n-command in require-dev so you can generate the .pot file locally, and a Composer script that calls wp:
"require-dev": {
"wp-cli/i18n-command": "^2.6"
},
"scripts": {
"makepot-audit": [
"wp --allow-root i18n make-pot . languages/my-plugin.pot --slug=my-plugin --exclude=\".github,node_modules,vendor,build,deploy\""
],
"makepot": [
"@makepot-audit --skip-audit"
]
}Code language: JavaScript (javascript)
The important bit is that the script calls plain wp, not vendor/bin/wp. You’ll see why in a minute.
Step 2: Let the action install WP-CLI for you
If you’re using the shivammathur/setup-php action to set up PHP and Composer (and you probably are), it can also install WP-CLI as a tool. The WP-CLI phar comes with the i18n command bundled in, so that’s everything makepot needs:
- name: "Sets up PHP with Composer and WP-CLI."
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer, wp-cliCode language: JavaScript (javascript)
Then if you still need a composer install step you can add --no-dev to it. If not, you can remove that step entirely:
# Install Composer packages!
- name: "Install Composer dependencies."
run: |
composer install --no-interaction --prefer-dist --no-devCode language: PHP (php)
I like to add wp --version to a debug step too, so if anything goes sideways the logs tell me whether WP-CLI actually got installed:
- name: "Logs debug information."
run: |
php --version
composer --version
wp --versionCode language: JavaScript (javascript)
Why the same script works locally and in the action
When Composer runs a script, it puts vendor/bin at the front of the PATH. So:
- Locally, where you’ve run
composer install,wpresolves tovendor/bin/wpfrom yourwp-cli/i18n-commanddev dependency. - In the action, there’s no
vendorfolder on a fresh checkout, sowpfalls through to the global WP-CLI thatsetup-phpinstalled.
Same script, same command, no special CI-only branch. That’s why it matters that the action script calls wp and not vendor/bin/wp.
The end result
One Composer install per release, and it’s the one that actually ships. Fewer downloads, faster builds, and one less thing to fight with (probably).
