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/fluffy-apes-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wpgraphql-webhooks-wordpress-plugin": patch
---

chore: Initial release of the plugin.
6 changes: 5 additions & 1 deletion .github/scripts/get-plugin-slug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ HEAD_SHA="$2"
git fetch --prune --unshallow 2>/dev/null || git fetch --prune

# Get changed files in plugins subdirectories
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep '^plugins/[^/]\+/' || true)
if [ "$BASE_SHA" = "release" ]; then
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^plugins/[^/]\+/' || true)
else
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep '^plugins/[^/]\+/' || true)
fi

if [ -z "$CHANGED_FILES" ]; then
echo "No plugin files changed"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ jobs:
- name: Get changed plugin directory
id: plugin
run: |
bash .github/scripts/get-plugin-slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
bash .github/scripts/get-plugin-slug.sh release


- name: Validate plugin detection
continue-on-error: false
Expand Down
20 changes: 10 additions & 10 deletions plugins/wp-graphql-webhooks/src/Type/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,52 @@ class Webhook {
* @return void
*/
public static function register(): void {
register_graphql_object_type( 'Webhook', [
register_graphql_object_type( 'Webhook', [
'description' => __( 'A Webhook configuration object.', 'wp-graphql-webhooks' ),
'fields' => [
'id' => [
'fields' => [
'id' => [
'type' => 'ID',
'description' => __( 'The global ID of the webhook.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return (string) $webhook->ID;
},
],
'eventTrigger' => [
'eventTrigger' => [
'type' => 'String',
'description' => __( 'The event hook name that triggers this webhook.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return get_post_meta( $webhook->ID, '_event_trigger', true );
},
],
'title' => [
'title' => [
'type' => 'String',
'description' => __( 'The title of the webhook.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return get_the_title( $webhook );
},
],
'enabled' => [
'enabled' => [
'type' => 'Boolean',
'description' => __( 'Whether the webhook is enabled.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return (bool) get_post_meta( $webhook->ID, '_enabled', true );
},
],
'security' => [
'security' => [
'type' => 'String',
'description' => __( 'Security information for the webhook.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return get_post_meta( $webhook->ID, '_security', true );
},
],
'handlerClass' => [
'handlerClass' => [
'type' => 'String',
'description' => __( 'The handler class used for dispatching.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
return get_post_meta( $webhook->ID, '_handler_class', true );
},
],
'handlerConfig' => [
'handlerConfig' => [
'type' => 'String',
'description' => __( 'Configuration for the handler.', 'wp-graphql-webhooks' ),
'resolve' => function ($webhook) {
Expand All @@ -75,4 +75,4 @@ public static function register(): void {
],
] );
}
}
}