Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/neat-knives-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wpgraphql-webhooks-wordpress-plugin": patch
---

chore: Initial release for wpgraphql-webhooks-wordpress-plugin.
16 changes: 7 additions & 9 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/next/webhooks-isr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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`
You can check if a port is free by running `lsof -i :11111`
2 changes: 1 addition & 1 deletion plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugins/wp-graphql-webhooks/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==
10 changes: 5 additions & 5 deletions plugins/wp-graphql-webhooks/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -150,4 +150,4 @@ public function __wakeup(): void {
}
}

endif;
endif;