Skip to content

Utsav-Ladani/wordpress-plugin-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress Plugin Check Action

A GitHub Action to run the WordPress Plugin Check (PCP) on your plugin and report results directly in your Pull Requests.

Screenshot 2025-11-21 at 10 50 16 PM

Features

  • 🚀 Easy Setup: Works out of the box with minimal configuration.
  • 🐳 Isolated Environment: Runs checks inside a temporary WordPress environment using wp-env.
  • 💬 PR Comments: Automatically posts a detailed report of errors and warnings to your Pull Request.
  • 🛡️ Zero Config: Automatically detects your plugin slug.

Usage

Create a workflow file (e.g., .github/workflows/plugin-check.yml) in your repository:

name: Plugin Check

on:
  pull_request:
    paths:
      - '**/*.php'
      - 'readme.txt'

jobs:
  check:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write  # Required to post/update PR comments
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Run Plugin Check
        uses: Utsav-Ladani/wordpress-plugin-check@main
        with:
          plugin: 'https://example.com/path/to/your-plugin.zip'
          # token: ${{ secrets.GITHUB_TOKEN }} # Optional, defaults to github.token

Inputs

Input Description Required Default
plugin Plugin ZIP URL or local path. Supports both remote ZIP files (e.g., https://example.com/plugin.zip) and local directories (e.g., ./my-plugin). Yes
token GitHub Token used to post comments. No ${{ github.token }}

Example Workflows

1. Check Plugin from ZIP URL

This example builds your plugin into a ZIP and checks it:

name: Plugin Check

on:
  pull_request:
  push:
    branches: [main]

jobs:
  check:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.1'

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Composer Dependencies
        run: composer install --no-dev --optimize-autoloader

      - name: Install NPM Dependencies
        run: npm install

      - name: Build Assets
        run: npm run build

      - name: Create Plugin ZIP
        run: npm run plugin-zip

      - name: Upload Plugin ZIP
        uses: actions/upload-artifact@v4
        id: upload-zip
        with:
          name: plugin-zip
          path: ./plugin.zip

      - name: Run Plugin Check
        uses: Utsav-Ladani/wordpress-plugin-check@main
        with:
          plugin: ${{ steps.upload-zip.outputs.artifact-url }}

2. Check Plugin from Local Directory

This example checks the plugin directly from your repository:

name: Plugin Check

on:
  pull_request:

jobs:
  check:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Run Plugin Check
        uses: Utsav-Ladani/wordpress-plugin-check@main
        with:
          plugin: './my-plugin'  # Check plugin in current directory

3. Check Plugin from GitHub Release

- name: Run Plugin Check
  uses: Utsav-Ladani/wordpress-plugin-check@main
  with:
    plugin: 'https://github.com/your-org/your-plugin/releases/download/v1.0.0/plugin.zip'

4. Check WordPress.org Plugin

- name: Run Plugin Check
  uses: Utsav-Ladani/wordpress-plugin-check@main
  with:
    plugin: 'https://downloads.wordpress.org/plugin/my-plugin.1.0.0.zip'

Development

This action is built using Node.js.

Build

To build the action for distribution:

npm install
npm run build

License

MIT

About

Run the WordPress Plugin Check and comment results on the PR

Topics

Resources

License

Stars

Watchers

Forks

Contributors