$npx -y skills add jdevalk/skills --skill wp-github-actionsSets up GitHub Actions CI/CD workflows for WordPress plugins — coding standards (WPCS/PHPCS), PHP/JS/CSS linting, PHPUnit testing, static analysis (PHPStan), Composer security scanning, WordPress Playground PR previews, and automated deployment to WordPress.org. ALWAYS use this s
| 1 | # WordPress Plugin GitHub Actions |
| 2 | |
| 3 | This skill helps you set up a comprehensive CI/CD pipeline for WordPress plugins using GitHub Actions. The goal is to help plugin authors ship higher-quality code with less manual effort. |
| 4 | |
| 5 | ## What this skill covers |
| 6 | |
| 7 | There are several categories of workflows that a healthy WordPress plugin should have. Not every plugin needs all of them — the right mix depends on the plugin's complexity, whether it has JavaScript/CSS assets, whether it uses Composer, etc. Your job is to figure out which ones are relevant and set them up. |
| 8 | |
| 9 | The workflows fall into these categories: |
| 10 | |
| 11 | 1. **Code quality** — WPCS/PHPCS checks, PHP linting, JS/CSS linting |
| 12 | 2. **Testing** — PHPUnit with WordPress test library |
| 13 | 3. **Static analysis** — PHPStan with WordPress extensions |
| 14 | 4. **Dependency management** — Composer diff on PRs, security scanning |
| 15 | 5. **Preview** — WordPress Playground PR previews |
| 16 | 6. **Deployment** — Automated deploy to WordPress.org on tag/release |
| 17 | |
| 18 | Read `references/workflows.md` for the detailed configuration of each workflow, including ready-to-use YAML templates and configuration files. |
| 19 | |
| 20 | ## How to approach a request |
| 21 | |
| 22 | ### Step 1: Understand the plugin |
| 23 | |
| 24 | Before writing any workflow files, figure out what you're working with: |
| 25 | |
| 26 | - **Does the plugin use Composer?** Check for `composer.json`. If yes, Composer-related workflows (diff, security, autoloading) are relevant. |
| 27 | - **Does it have JavaScript/CSS assets?** Check for `package.json`, any JS/CSS source files, or a build process. If yes, JS/CSS linting and possibly a build step matter. |
| 28 | - **Does it have tests?** Check for a `tests/` directory, `phpunit.xml`, or `phpunit.xml.dist`. If yes, set up the PHPUnit workflow. If not, mention that adding tests would be valuable but don't force it. |
| 29 | - **Is it on WordPress.org?** Check for a `.wordpress-org` directory or ask. If yes, the deploy workflow is relevant and you should also set up `.distignore`. |
| 30 | - **What PHP versions should it support?** WordPress itself requires PHP 7.4+, but many plugins target 7.4, 8.0, 8.1, 8.2, and 8.3. Check the plugin's readme or ask. |
| 31 | - **What WordPress versions?** Similarly, check what WP versions the plugin declares compatibility with. |
| 32 | |
| 33 | ### Step 2: Recommend a set of workflows |
| 34 | |
| 35 | Based on what you found, recommend which workflows to set up. A good default for most plugins: |
| 36 | |
| 37 | - WPCS check (almost always) |
| 38 | - PHP lint (almost always — catches syntax errors across PHP versions) |
| 39 | - PHPUnit tests (if tests exist) |
| 40 | - Deploy to WordPress.org (if on WordPress.org) |
| 41 | - Playground PR preview (nice to have for any plugin) |
| 42 | |
| 43 | And conditionally: |
| 44 | |
| 45 | - JS/CSS linting (if the plugin has frontend assets) |
| 46 | - Composer diff + security (if using Composer) |
| 47 | - PHPStan (for plugins that want deeper static analysis) |
| 48 | |
| 49 | ### Step 3: Create the workflow files |
| 50 | |
| 51 | Create each workflow as a separate YAML file in `.github/workflows/`. Using separate files rather than one monolithic workflow gives clearer feedback in PRs (each check shows independently) and makes it easier to enable/disable individual checks. |
| 52 | |
| 53 | Use the templates from `references/workflows.md` as starting points, but adapt them to the specific plugin. Common adaptations include adjusting PHP version matrices, changing the WPCS standard, adjusting file paths, and tweaking the deploy workflow for plugins with build steps. |
| 54 | |
| 55 | ### Step 4: Create supporting config files |
| 56 | |
| 57 | Depending on which workflows you set up, you may also need: |
| 58 | |
| 59 | - `phpcs.xml.dist` — Custom PHPCS ruleset (if the plugin needs rule exclusions or custom config) |
| 60 | - `.distignore` — Files to exclude from WordPress.org deployment |
| 61 | - `phpstan.neon |