WordPress Plugin CI
Reusable continuous integration pipeline for WordPress plugins. Runs PHP code quality checks and optionally builds and lints the front-end (TypeScript/Vite).
Trigger
yaml
on:
workflow_call:Called via uses: from the plugin repository's CI workflow.
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
php-versions | string | '["8.3", "8.4"]' | JSON array of PHP versions for the matrix |
node-version | string | '22' | Node.js version for UI builds |
has-ui | boolean | false | Enable build of the ui/ directory with npm |
has-tests | boolean | false | Run composer test |
has-phpstan | boolean | true | Run composer check:stan (PHPStan) |
has-cs-fixer | boolean | true | Run composer check:style (PHP CS Fixer) |
has-rector | boolean | false | Run composer check:rector (Rector) |
php-extensions | string | 'mbstring, xml' | PHP extensions to install |
needs-github-app-auth | boolean | false | Generate GitHub App token for private Composer repos (e.g. my-package) |
Secrets
Required only when needs-github-app-auth: true:
| Secret / Variable | Type | Description |
|---|---|---|
PRIVATESATIS_BOT_APP_ID | org variable | GitHub App ID for privatesatis-bot |
PRIVATESATIS_BOT_PRIVATE_KEY | org secret | GitHub App PEM private key |
Jobs
php — PHP Matrix
Runs on ubuntu-latest for each PHP version in the matrix:
- Checkout the code.
- Generate GitHub App token (if
needs-github-app-auth). - Configure Composer/Git auth for private repos (if
needs-github-app-auth). - Setup PHP with the configured extensions.
- Install Composer dependencies (
composer install --no-interaction --prefer-dist). - Check code style —
composer check:style(ifhas-cs-fixer). - PHPStan —
composer check:stan(ifhas-phpstan). - Rector —
composer check:rector(ifhas-rector). - Tests —
composer test(ifhas-tests).
ui — UI Build
Runs only if has-ui: true:
- Checkout the code.
- Setup Node.js with npm cache pointing to
ui/package-lock.json. - Install dependencies —
npm ciin theui/directory. - Type check —
npx tsc --noEmit. - Lint —
npm run lint. - Build —
npm run build.
Usage example
yaml
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
ci:
uses: middag-io/.github-private/.github/workflows/wp-plugin-ci.yml@workflows-v1
with:
has-phpstan: true
has-cs-fixer: true
has-tests: true
has-ui: true
needs-github-app-auth: true
secrets: inheritMinimal configuration (no UI, no tests)
yaml
jobs:
ci:
uses: middag-io/.github-private/.github/workflows/wp-plugin-ci.yml@workflows-v1
secrets: inheritThe defaults already enable PHPStan and CS Fixer.