Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Runs WordPress Plugin Check on modified plugins to ensure compliance with
# WordPress.org guidelines and coding standards.
#
# https://wordpress.org/plugins/plugin-check/

name: Plugin Check

on:
push:
branches:
- main
paths:
- 'plugins/**/*.php'
pull_request:
branches:
- main
paths:
- 'plugins/**/*.php'

jobs:
detect-plugins:
runs-on: ubuntu-latest
name: Detect modified plugins
outputs:
plugins: ${{ steps.detect.outputs.plugins }}
has-plugins: ${{ steps.detect.outputs.has-plugins }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get changed plugin directories
id: plugin
run: |
if [ "${{ github.event_name }}" = "push" ]; then
bash .github/scripts/get_plugin_slug.sh main
else
bash .github/scripts/get_plugin_slug.sh \
${{ github.event.pull_request.base.sha }} \
${{ github.event.pull_request.head.sha }}
fi

- name: Set output
id: detect
run: |
# get_plugin_slug.sh outputs: slug, plugins (JSON array), has-plugins
if [ -z "${{ steps.plugin.outputs.slug }}" ]; then
echo "plugins=[]" >> $GITHUB_OUTPUT
echo "has-plugins=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "plugins=${{ steps.plugin.outputs.plugins }}" >> $GITHUB_OUTPUT
echo "has-plugins=${{ steps.plugin.outputs.has-plugins }}" >> $GITHUB_OUTPUT

plugin-check:
needs: detect-plugins
if: needs.detect-plugins.outputs.has-plugins == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
plugin: ${{ fromJson(needs.detect-plugins.outputs.plugins) }}
fail-fast: false
name: ${{ matrix.plugin }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: plugins/${{ matrix.plugin }}
exclude-directories: |
.git
vendor
node_modules
tests