From 8af1b394e92dd20b3ddd328c67b80dd5a340ad4b Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Mon, 30 Jun 2025 12:48:08 +0100 Subject: [PATCH 1/2] Fixed pre-release workflow. Updated README for docs. Removed trailing spaces in Webhooks plugin to force a release. --- .github/workflows/create-release-branch.yml | 16 +++++++--------- examples/next/webhooks-isr/README.md | 4 ++-- plugins/README.md | 2 +- plugins/wp-graphql-webhooks/readme.txt | 2 +- plugins/wp-graphql-webhooks/src/Plugin.php | 10 +++++----- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index 62c6dd50..a3801a12 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -45,14 +45,12 @@ jobs: - name: Get changed plugin directory id: plugin run: | - git fetch --prune --unshallow 2>/dev/null || git fetch --prune - plugin=$(git diff --name-only HEAD~1 HEAD | grep '^plugins/' | head -1 | cut -d/ -f2) - echo "plugin_slug=$plugin" >> $GITHUB_OUTPUT + bash .github/scripts/get-plugin-slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} - name: Validate plugin detection continue-on-error: false run: | - if [ ! -d "plugins/${{ steps.plugin.outputs.plugin_slug }}" ]; then + if [ ! -d "plugins/${{ steps.plugin.outputs.slug }}" ]; then echo "Plugin directory does not exist" exit 1 fi @@ -63,7 +61,7 @@ jobs: - name: Create release branch and apply changesets run: | # Create a unique branch name with timestamp - BRANCH_NAME="release/${{ steps.plugin.outputs.plugin_slug }}-$(date +%Y%m%d-%H%M%S)" + BRANCH_NAME="release/${{ steps.plugin.outputs.slug }}-$(date +%Y%m%d-%H%M%S)" echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV # Create and switch to release branch @@ -81,17 +79,17 @@ jobs: if git diff --staged --quiet; then echo "No changes to commit" else - git commit -m "chore: apply version bump from changesets for ${{ steps.plugin.outputs.plugin_slug }}" + git commit -m "chore: apply version bump from changesets for ${{ steps.plugin.outputs.slug }}" git push origin "$BRANCH_NAME" # Create PR gh pr create \ - --title "Release: ${{ steps.plugin.outputs.plugin_slug }} version bump" \ - --body "Automated release PR for ${{ steps.plugin.outputs.plugin_slug }} plugin. + --title "Release: ${{ steps.plugin.outputs.slug }} version bump" \ + --body "Automated release PR for ${{ steps.plugin.outputs.slug }} plugin. This PR applies version bumps from changesets. Once merged, it will trigger the pre-release creation workflow. - Plugin: ${{ steps.plugin.outputs.plugin_slug }}" \ + Plugin: ${{ steps.plugin.outputs.slug }}" \ --base main \ --head "$BRANCH_NAME" fi diff --git a/examples/next/webhooks-isr/README.md b/examples/next/webhooks-isr/README.md index aa1dfae7..518856d1 100644 --- a/examples/next/webhooks-isr/README.md +++ b/examples/next/webhooks-isr/README.md @@ -20,7 +20,7 @@ This integration enables seamless communication between a WordPress backend and ## Prerequisites -* WordPress site with the wpgraphql-headless-webhooks plugin installed. +* WordPress site with the wpgraphql-webhooks plugin installed. * Next.js project (Node.js v18+ recommended). * Environment variables configured for WordPress URL and webhook secret. @@ -200,4 +200,4 @@ Congratulations, WordPress should now be fully set up. If you need database access add the following to your wp-env `"phpmyadminPort": 11111,` (where port 11111 is not allocated). -You can check if a port is free by running `lsof -i :11111` \ No newline at end of file +You can check if a port is free by running `lsof -i :11111` diff --git a/plugins/README.md b/plugins/README.md index 6274daa5..abdfa5a0 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -7,7 +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-headless-webhooks`](./wp-graphql-headless-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. | +| [`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. | ## Contributing diff --git a/plugins/wp-graphql-webhooks/readme.txt b/plugins/wp-graphql-webhooks/readme.txt index 86fe536a..dcfc9e7b 100644 --- a/plugins/wp-graphql-webhooks/readme.txt +++ b/plugins/wp-graphql-webhooks/readme.txt @@ -10,7 +10,7 @@ License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html == Description == -== Upgrade Notice == +== Upgrade Notice == == Frequently Asked Questions == == Screenshots == == Changelog == diff --git a/plugins/wp-graphql-webhooks/src/Plugin.php b/plugins/wp-graphql-webhooks/src/Plugin.php index e8774da1..1f850771 100644 --- a/plugins/wp-graphql-webhooks/src/Plugin.php +++ b/plugins/wp-graphql-webhooks/src/Plugin.php @@ -79,11 +79,11 @@ private function setup(): void { $this->services->set( 'event_manager', function () { $repository = $this->services->get( 'repository' ); $handler = $this->services->get( 'handler' ); - + if ( class_exists( 'WPGraphQL\SmartCache\Document' ) || defined( 'WPGRAPHQL_SMART_CACHE_VERSION' ) ) { return new SmartCacheWebhookManager( $repository, $handler ); } - + return new WebhookEventManager( $repository, $handler ); } ); // Initialize event manager and register hooks @@ -93,7 +93,7 @@ private function setup(): void { // Initialize admin UI if ( is_admin() ) { $repository = $this->services->get( 'repository' ); - + if ( class_exists( 'WPGraphQL\Webhooks\Admin\WebhooksAdmin' ) ) { $admin = new \WPGraphQL\Webhooks\Admin\WebhooksAdmin( $repository ); $admin->init(); @@ -103,7 +103,7 @@ private function setup(): void { // Initialize REST endpoints add_action( 'rest_api_init', function () { $repository = $this->services->get( 'repository' ); - + if ( class_exists( 'WPGraphQL\Webhooks\Rest\WebhookTestEndpoint' ) ) { $testEndpoint = new \WPGraphQL\Webhooks\Rest\WebhookTestEndpoint( $repository ); $testEndpoint->register_routes(); @@ -150,4 +150,4 @@ public function __wakeup(): void { } } -endif; \ No newline at end of file +endif; From eee0682e995c33bd95d60658f01f0e8fa9c41d7b Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Mon, 30 Jun 2025 12:49:23 +0100 Subject: [PATCH 2/2] Added Changeset --- .changeset/neat-knives-attend.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/neat-knives-attend.md diff --git a/.changeset/neat-knives-attend.md b/.changeset/neat-knives-attend.md new file mode 100644 index 00000000..bc8036a2 --- /dev/null +++ b/.changeset/neat-knives-attend.md @@ -0,0 +1,5 @@ +--- +"@wpengine/wpgraphql-webhooks-wordpress-plugin": patch +--- + +chore: Initial release for wpgraphql-webhooks-wordpress-plugin.