Skip to content
Closed
Show file tree
Hide file tree
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
27 changes: 26 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,32 @@ jobs:
exit 0
fi

PLUGIN="${{ steps.plugin.outputs.slug }}"
# Extract unique plugin names and check for phpcs.xml
PLUGINS_WITH_CONFIG=()
CHECKED_PLUGINS=()

for file in $CHANGED_FILES; do
# Skip if this is not a file within a plugin subdirectory
if [[ ! "$file" =~ ^plugins/[^/]+/.+ ]]; then
continue
fi

plugin=$(echo $file | cut -d/ -f2)

# Skip if we already checked this plugin
if [[ " ${CHECKED_PLUGINS[@]} " =~ " $plugin " ]]; then
continue
fi

CHECKED_PLUGINS+=("$plugin")

if [ -f "plugins/$plugin/phpcs.xml" ]; then
PLUGINS_WITH_CONFIG+=("$plugin")
echo "✅ Found phpcs.xml for plugin: $plugin"
else
echo "ℹ️ No phpcs.xml found for plugin: $plugin, skipping quality checks"
fi
done

if [ -f "plugins/$PLUGIN/phpcs.xml" ]; then
echo "plugins=[\"$PLUGIN\"]" >> $GITHUB_OUTPUT
Expand Down
34 changes: 33 additions & 1 deletion .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,39 @@ jobs:
exit 0
fi

PLUGIN="${{ steps.plugin.outputs.slug }}"
# Extract unique plugin names and check for test config
PLUGINS_WITH_CONFIG=()
CHECKED_PLUGINS=()

for file in $CHANGED_FILES; do
# Skip if this is not a file within a plugin subdirectory
if [[ ! "$file" =~ ^plugins/[^/]+/.+ ]]; then
continue
fi

plugin=$(echo $file | cut -d/ -f2)

# Skip if we already checked this plugin
if [[ " ${CHECKED_PLUGINS[@]} " =~ " $plugin " ]]; then
continue
fi

CHECKED_PLUGINS+=("$plugin")

# Check for both codeception.dist.yml and composer.json
if [ -f "plugins/$plugin/codeception.dist.yml" ] && [ -f "plugins/$plugin/composer.json" ]; then
PLUGINS_WITH_CONFIG+=("$plugin")
echo "✅ Found test config for plugin: $plugin (codeception.dist.yml + composer.json)"
else
echo "ℹ️ Missing test config for plugin: $plugin, skipping tests"
if [ ! -f "plugins/$plugin/codeception.dist.yml" ]; then
echo " - Missing: codeception.dist.yml"
fi
if [ ! -f "plugins/$plugin/composer.json" ]; then
echo " - Missing: composer.json"
fi
fi
done

if [ -f "plugins/$PLUGIN/codeception.dist.yml" ]; then
echo "plugins=[\"$PLUGIN\"]" >> $GITHUB_OUTPUT
Expand Down
37 changes: 36 additions & 1 deletion .github/workflows/plugin-artifact-for-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,42 @@ jobs:
- name: Get changed plugin directory
id: plugin
run: |
bash .github/scripts/get-plugin-slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
git fetch --prune --unshallow

# Get changed files in plugins subdirectories
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' || true)

if [ -z "$CHANGED_FILES" ]; then
echo "No plugin files changed"
exit 1
fi

# Extract plugin names from both old and new paths
PLUGINS=()
for file in $CHANGED_FILES; do
plugin=$(echo $file | cut -d/ -f2)
PLUGINS+=("$plugin")
done

# Get unique plugin names
UNIQUE_PLUGINS=($(printf '%s\n' "${PLUGINS[@]}" | sort -u))

# Find the first plugin that actually exists
PLUGIN_SLUG=""
for plugin in "${UNIQUE_PLUGINS[@]}"; do
if [ -d "plugins/$plugin" ]; then
PLUGIN_SLUG="$plugin"
echo "Found existing plugin directory: $PLUGIN_SLUG"
break
fi
done

if [ -z "$PLUGIN_SLUG" ]; then
echo "No valid plugin directory found"
exit 1
fi

echo "slug=$PLUGIN_SLUG" >> $GITHUB_OUTPUT

- name: Create plugin artifact
uses: ./.github/actions/create-plugin-artifact
Expand Down
2 changes: 1 addition & 1 deletion examples/next/webhooks-isr/.wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"https://github.com/wp-graphql/wp-graphql/releases/latest/download/wp-graphql.zip",
"https://github.com/wp-graphql/wp-graphql-smart-cache/releases/download/v2.0.0/wpgraphql-smart-cache.zip",
"https://downloads.wordpress.org/plugin/code-snippets.3.6.8.zip",
"../../../plugins/wp-graphql-webhooks"
"../../../plugins/wpgraphql-webhooks"
],
"config": {
"WP_DEBUG": true,
Expand Down
3 changes: 1 addition & 2 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ WordPress plugins for the Headless WordPress Toolkit. Each plugin is paired with
| Plugin | Description |
|--------|-------------|
| [`hwp-previews`](./hwp-previews/README.md) | Headless Previews solution for WordPress: fully configurable preview URLs via the settings page which is framework agnostic. |
| [`wp-graphql-webhooks`](./wp-graphql-webhooks/README.md) | A WordPress plugin that extends [WPGraphQL](https://www.wpgraphql.com/) to support webhook subscriptions and dispatching for headless WordPress environments. This allows external applications to listen and respond to WordPress content changes through GraphQL-driven webhook events. |

| [`wpgraphql-webhooks`](./wpgraphql-webhooks/README.md) | A WordPress plugin that extends [WPGraphQL](https://www.wpgraphql.com/) to support webhook subscriptions and dispatching for headless WordPress environments. This allows external applications to listen and respond to WordPress content changes through GraphQL-driven webhook events. |

## Contributing

Expand Down
36 changes: 36 additions & 0 deletions plugins/wpgraphql-webhooks/.distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/.devcontainer
/.git
/.github
/.idea
/.log
/.vscode
/.wordpress-org
/bin
/docker
/docker-output
/docs
/img
/phpstan
/plugin-build
/tests

.coveralls.yml
.distignore
.dockerignore
.DS_Store
.env
.env.dist
.gitattributes
.gitignore
.phpcs.xml
.phpcs.xml.dist
.travis.yml
CHANGELOG.md
codeception.dist.yml
codeception.yml
composer.json
composer.lock
docker-compose.yml
phpstan.neon.dist
README.md
schema.graphql
27 changes: 27 additions & 0 deletions plugins/wpgraphql-webhooks/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
tab_width = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.txt]
trim_trailing_whitespace = false

[*.{md,json,yml}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.json]
indent_style = tab
38 changes: 38 additions & 0 deletions plugins/wpgraphql-webhooks/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
DB_NAME=wordpress
DB_HOST=app_db
DB_USER=wordpress
DB_PASSWORD=wordpress
WP_TABLE_PREFIX=wp_
WP_URL=http://localhost
WP_DOMAIN=localhost
ADMIN_EMAIL=admin@example.com
ADMIN_USERNAME=admin
ADMIN_PASSWORD=root
ADMIN_PATH=/wp-admin

TEST_DB_NAME=wptests
TEST_DB_HOST=127.0.0.1
TEST_DB_USER=root
TEST_DB_PASSWORD=
TEST_WP_TABLE_PREFIX=wp_

SKIP_DB_CREATE=false
TEST_WP_ROOT_FOLDER=/tmp/wordpress
TEST_ADMIN_EMAIL=admin@wp.test

TESTS_DIR=tests
TESTS_OUTPUT=tests/_output
TESTS_DATA=tests/_data
TESTS_SUPPORT=tests/_support
TESTS_ENVS=tests/_envs

CORE_BRANCH=develop
SKIP_TESTS_CLEANUP=1
SUITES=wpunit

WORDPRESS_DB_HOST=${DB_HOST}
WORDPRESS_DB_USER=${DB_USER}
WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
WORDPRESS_DB_NAME=${DB_NAME}

PLUGIN_SLUG=wpgraphql-webhooks
20 changes: 20 additions & 0 deletions plugins/wpgraphql-webhooks/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

/.github export-ignore
/assets export-ignore
/bin export-ignore
/docker export-ignore
/docs export-ignore
/phpstan export-ignore
/tests export-ignore

/.coveralls export-ignore
/.distignore export-ignore
/.dockerignore export-ignore
/.env.dist export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpcs.xml.dist export-ignore
/composer.lock export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
49 changes: 49 additions & 0 deletions plugins/wpgraphql-webhooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Hidden files
.DS_Store
Thumbs.db

# IDE Files
.devcontainer/*
.devcontainer.json
.vscode
.idea

# Environment variables for testing
.env
.env.*
!.env.dist

# Ruleset Overrides
phpcs.xml
phpunit.xml
phpstan.neon

# Directory to generate the dist zipfile
plugin-build

# Composer auth
auth.json

# Composer deps
vendor

# NPM deps
node_modules

# Generated Schema used in some tooling. Versioned Schema is uploaded as a Release artifact to Github.
schema.graphql

# WP CLI config overrides
wp-cli.local.yml

# Tests
*.sql
*.tar.gz
!tests
tests/*.suite.yml
coverage/*
build/
.log/

# Cache
phpcs-cache.json
Loading
Loading