Skip to content

Commit 84e39a6

Browse files
authored
Merge pull request #299 from wpengine/chore-fix-for-plugin-slug-script-for-release-branch
chore: Fixes for release branch workflow.
2 parents 59979c9 + 3970914 commit 84e39a6

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

.changeset/fluffy-apes-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@wpengine/wpgraphql-webhooks-wordpress-plugin": patch
3+
---
4+
5+
chore: Initial release of the plugin.

.github/scripts/get-plugin-slug.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ HEAD_SHA="$2"
88
git fetch --prune --unshallow 2>/dev/null || git fetch --prune
99

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

1317
if [ -z "$CHANGED_FILES" ]; then
1418
echo "No plugin files changed"

.github/workflows/create-release-branch.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
- name: Get changed plugin directory
4646
id: plugin
4747
run: |
48-
bash .github/scripts/get-plugin-slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
48+
bash .github/scripts/get-plugin-slug.sh release
49+
4950
5051
- name: Validate plugin detection
5152
continue-on-error: false

plugins/wp-graphql-webhooks/src/Type/Webhook.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,52 @@ class Webhook {
2020
* @return void
2121
*/
2222
public static function register(): void {
23-
register_graphql_object_type( 'Webhook', [
23+
register_graphql_object_type( 'Webhook', [
2424
'description' => __( 'A Webhook configuration object.', 'wp-graphql-webhooks' ),
25-
'fields' => [
26-
'id' => [
25+
'fields' => [
26+
'id' => [
2727
'type' => 'ID',
2828
'description' => __( 'The global ID of the webhook.', 'wp-graphql-webhooks' ),
2929
'resolve' => function ($webhook) {
3030
return (string) $webhook->ID;
3131
},
3232
],
33-
'eventTrigger' => [
33+
'eventTrigger' => [
3434
'type' => 'String',
3535
'description' => __( 'The event hook name that triggers this webhook.', 'wp-graphql-webhooks' ),
3636
'resolve' => function ($webhook) {
3737
return get_post_meta( $webhook->ID, '_event_trigger', true );
3838
},
3939
],
40-
'title' => [
40+
'title' => [
4141
'type' => 'String',
4242
'description' => __( 'The title of the webhook.', 'wp-graphql-webhooks' ),
4343
'resolve' => function ($webhook) {
4444
return get_the_title( $webhook );
4545
},
4646
],
47-
'enabled' => [
47+
'enabled' => [
4848
'type' => 'Boolean',
4949
'description' => __( 'Whether the webhook is enabled.', 'wp-graphql-webhooks' ),
5050
'resolve' => function ($webhook) {
5151
return (bool) get_post_meta( $webhook->ID, '_enabled', true );
5252
},
5353
],
54-
'security' => [
54+
'security' => [
5555
'type' => 'String',
5656
'description' => __( 'Security information for the webhook.', 'wp-graphql-webhooks' ),
5757
'resolve' => function ($webhook) {
5858
return get_post_meta( $webhook->ID, '_security', true );
5959
},
6060
],
61-
'handlerClass' => [
61+
'handlerClass' => [
6262
'type' => 'String',
6363
'description' => __( 'The handler class used for dispatching.', 'wp-graphql-webhooks' ),
6464
'resolve' => function ($webhook) {
6565
return get_post_meta( $webhook->ID, '_handler_class', true );
6666
},
6767
],
68-
'handlerConfig' => [
68+
'handlerConfig' => [
6969
'type' => 'String',
7070
'description' => __( 'Configuration for the handler.', 'wp-graphql-webhooks' ),
7171
'resolve' => function ($webhook) {
@@ -75,4 +75,4 @@ public static function register(): void {
7575
],
7676
] );
7777
}
78-
}
78+
}

0 commit comments

Comments
 (0)