Skip to content

Commit 6fbb867

Browse files
authored
Merge pull request #362 from wpengine/rename-wp-graphql-webhooks
chore: wp-graphql-webhooks -> wpgraphql-webhooks
2 parents 9903f32 + 730646a commit 6fbb867

File tree

114 files changed

+879
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+879
-472
lines changed

.changeset/nice-mails-sort.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@wpengine/wpgraphql-debug-extensions-wordpress-plugin": patch
3+
"@wpengine/wpgraphql-webhooks-wordpress-plugin": patch
4+
---
5+
6+
chore: wp-graphql-webhooks -> wpgraphql-webhooks

.github/scripts/get_plugin_slug.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,40 @@ done
2929
# Get unique plugin names
3030
UNIQUE_PLUGINS=($(printf '%s\n' "${PLUGINS[@]}" | sort -u))
3131

32-
# Find the first plugin that actually exists
33-
PLUGIN_SLUG=""
32+
# Find all valid plugins that have changes
33+
VALID_PLUGINS=()
3434
for plugin in "${UNIQUE_PLUGINS[@]}"; do
35-
if [ -d "plugins/$plugin" ] || [[ " ${CHANGED_FILES[@]} " =~ "plugins/$plugin/" ]]; then
36-
PLUGIN_SLUG="$plugin"
37-
echo "Found plugin in changes or directory: $PLUGIN_SLUG"
38-
break
35+
if [ -d "plugins/$plugin" ]; then
36+
count=$(printf '%s\n' "${PLUGINS[@]}" | grep -c "^$plugin$")
37+
VALID_PLUGINS+=("$plugin")
38+
echo "Found plugin with $count changes: $plugin"
3939
fi
4040
done
4141

42+
# Output all valid plugins as JSON array for matrix strategy
43+
if [ ${#VALID_PLUGINS[@]} -gt 0 ]; then
44+
# Simple, reliable JSON array generation
45+
PLUGINS_JSON="["
46+
for i in "${!VALID_PLUGINS[@]}"; do
47+
if [ $i -eq 0 ]; then
48+
PLUGINS_JSON="$PLUGINS_JSON\"${VALID_PLUGINS[i]}\""
49+
else
50+
PLUGINS_JSON="$PLUGINS_JSON,\"${VALID_PLUGINS[i]}\""
51+
fi
52+
done
53+
PLUGINS_JSON="$PLUGINS_JSON]"
54+
55+
echo "plugins=$PLUGINS_JSON" >> "$GITHUB_OUTPUT"
56+
echo "has-plugins=true" >> "$GITHUB_OUTPUT"
57+
58+
# For backward compatibility, set slug to first plugin
59+
PLUGIN_SLUG="${VALID_PLUGINS[0]}"
60+
else
61+
echo "plugins=[]" >> "$GITHUB_OUTPUT"
62+
echo "has-plugins=false" >> "$GITHUB_OUTPUT"
63+
PLUGIN_SLUG=""
64+
fi
65+
4266
if [ -z "$PLUGIN_SLUG" ]; then
4367
echo "No valid plugin directory found"
4468
exit 1

.github/scripts/update_composer_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ usage() {
1818
echo " description - Optional: Package description (uses generic default if not provided)"
1919
echo ""
2020
echo "Examples:"
21-
echo " $0 '0.0.2' 'https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.2/wp-graphql-webhooks.zip'"
21+
echo " $0 '0.0.2' 'https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.2/wpgraphql-webhooks.zip'"
2222
echo ""
2323
echo " With custom package name and description:"
2424
echo " $0 '0.0.5' 'https://example.com/plugin.zip' 'wpengine/my-plugin' 'My custom plugin description'"

.github/workflows/plugin-artifact-for-pr.yml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,68 @@ on:
99
- 'plugins/*/**.json'
1010

1111
jobs:
12-
create-plugin-artifact:
13-
name: Create Plugin Artifact
12+
detect-plugins:
13+
name: Detect Changed Plugins
1414
runs-on: ubuntu-latest
15-
15+
outputs:
16+
plugins: ${{ steps.plugin.outputs.plugins }}
17+
has-plugins: ${{ steps.plugin.outputs.has-plugins }}
1618
steps:
1719
- name: Checkout
1820
uses: actions/checkout@v4
1921

20-
- name: Get changed plugin directory
22+
- name: Get changed plugin directories
2123
id: plugin
2224
run: |
2325
bash .github/scripts/get_plugin_slug.sh \
2426
${{ github.event.pull_request.base.sha }} \
2527
${{ github.event.pull_request.head.sha }}
2628
27-
- name: Create plugin artifact
29+
create-plugin-artifacts:
30+
name: Create Plugin Artifacts
31+
runs-on: ubuntu-latest
32+
needs: detect-plugins
33+
if: needs.detect-plugins.outputs.has-plugins == 'true'
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
plugin: ${{ fromJson(needs.detect-plugins.outputs.plugins) }}
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Create plugin artifact for ${{ matrix.plugin }}
2844
uses: ./.github/actions/create-plugin-artifact
29-
env:
30-
PLUGIN_SLUG: ${{ steps.plugin.outputs.slug }}
3145
with:
32-
slug: ${{ env.PLUGIN_SLUG }}
46+
slug: ${{ matrix.plugin }}
3347
composer-options: '--no-progress --optimize-autoloader --no-dev'
3448

35-
- name: Comment with artifact link
49+
comment-on-pr:
50+
name: Comment with Artifact Links
51+
runs-on: ubuntu-latest
52+
needs: [detect-plugins, create-plugin-artifacts]
53+
if: needs.detect-plugins.outputs.has-plugins == 'true'
54+
steps:
55+
- name: Comment with artifact links
3656
uses: actions/github-script@v7
3757
env:
38-
PLUGIN_SLUG: ${{ steps.plugin.outputs.slug }}
58+
PLUGINS: ${{ needs.detect-plugins.outputs.plugins }}
3959
with:
4060
github-token: ${{ secrets.GITHUB_TOKEN }}
4161
script: |
4262
const pr = context.payload.pull_request;
4363
const runId = context.runId;
4464
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
45-
const slug = process.env.PLUGIN_SLUG;
46-
const body = `ℹ️ [Download the latest ${slug} plugin zip from this PR](${artifactUrl})\n<em>(See the 'Artifacts' section at the bottom)</em>`;
65+
const plugins = JSON.parse(process.env.PLUGINS);
66+
67+
let body = '## 📦 Plugin Artifacts Ready!\n\n';
68+
body += `[Download from GitHub Actions run](${artifactUrl})\n\n`;
69+
body += '**Available plugins:**\n';
70+
plugins.forEach(plugin => {
71+
body += `- ✅ ${plugin}.zip\n`;
72+
});
73+
body += '\n<em>See the "Artifacts" section at the bottom of the Actions run page</em>';
4774
4875
// Find existing comment from this bot
4976
const comments = await github.rest.issues.listComments({
@@ -55,7 +82,7 @@ jobs:
5582
const botComment = comments.data.find(comment =>
5683
comment.user.type === 'Bot' &&
5784
comment.user.login === 'github-actions[bot]' &&
58-
comment.body.includes(`ℹ️ [Download the latest ${slug} plugin zip from this PR]`)
85+
comment.body.includes('## 📦 Plugin Artifacts Ready!')
5986
);
6087
6188
if (botComment) {

docs/how-to/install-toolkit-plugins/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Copy and use this example as your `composer.json` for a typical WordPress projec
2626
],
2727
"require": {
2828
"wpengine/hwp-previews": "*",
29-
"wpengine/wp-graphql-webhooks": "*"
29+
"wpengine/wpgraphql-webhooks": "*"
3030
},
3131
"config": {
3232
"allow-plugins": {
@@ -57,7 +57,7 @@ Copy and use this example as your `composer.json` for a typical WordPress projec
5757
To update to the latest version:
5858

5959
```bash
60-
composer update wpengine/hwp-previews wpengine/wp-graphql-webhooks
60+
composer update wpengine/hwp-previews wpengine/wpgraphql-webhooks
6161
```
6262

6363
---

plugins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WordPress plugins for the Headless WordPress Toolkit. Each plugin is paired with
77
| Plugin | Description |
88
|--------|-------------|
99
| [`hwp-previews`](./hwp-previews/README.md) | Headless Previews solution for WordPress: fully configurable preview URLs via the settings page which is framework agnostic. |
10-
| [`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. |
10+
| [`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. |
1111

1212

1313
## Install

plugins/composer-packages.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@
238238
}
239239
}
240240
},
241-
"wpengine/wp-graphql-webhooks": {
241+
"wpengine/wpgraphql-webhooks": {
242242
"0.0.4": {
243-
"name": "wpengine/wp-graphql-webhooks",
243+
"name": "wpengine/wpgraphql-webhooks",
244244
"version": "0.0.4",
245245
"type": "wordpress-plugin",
246246
"description": "Headless webhooks for WPGraphQL",
@@ -258,15 +258,15 @@
258258
"email": "[email protected]"
259259
},
260260
"dist": {
261-
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.4/wp-graphql-webhooks.zip",
261+
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.4/wpgraphql-webhooks.zip",
262262
"type": "zip"
263263
},
264264
"require": {
265265
"composer/installers": "~1.0 || ~2.0"
266266
}
267267
},
268268
"0.0.3": {
269-
"name": "wpengine/wp-graphql-webhooks",
269+
"name": "wpengine/wpgraphql-webhooks",
270270
"version": "0.0.3",
271271
"type": "wordpress-plugin",
272272
"description": "Headless webhooks for WPGraphQL",
@@ -284,15 +284,15 @@
284284
"email": "[email protected]"
285285
},
286286
"dist": {
287-
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.3/wp-graphql-webhooks.zip",
287+
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.3/wpgraphql-webhooks.zip",
288288
"type": "zip"
289289
},
290290
"require": {
291291
"composer/installers": "~1.0 || ~2.0"
292292
}
293293
},
294294
"0.0.2": {
295-
"name": "wpengine/wp-graphql-webhooks",
295+
"name": "wpengine/wpgraphql-webhooks",
296296
"version": "0.0.2",
297297
"type": "wordpress-plugin",
298298
"description": "Headless webhooks for WPGraphQL",
@@ -310,7 +310,7 @@
310310
"email": "[email protected]"
311311
},
312312
"dist": {
313-
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.2/wp-graphql-webhooks.zip",
313+
"url": "https://github.com/wpengine/hwptoolkit/releases/download/%40wpengine%2Fwpgraphql-webhooks-wordpress-plugin-0.0.2/wpgraphql-webhooks.zip",
314314
"type": "zip"
315315
},
316316
"require": {

plugins/wpgraphql-debug-extensions/bin/install-test-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ setup_plugin() {
149149
fi
150150

151151
# Add this repo as a plugin to the repo
152-
if [ ! -d $WORDPRESS_ROOT_DIR/wp-content/plugins/wp-graphql-webhooks ]; then
152+
if [ ! -d $WORDPRESS_ROOT_DIR/wp-content/plugins/wpgraphql-webhooks ]; then
153153
echo -e "$(status_message "Symlinking the plugin to the WordPress plugins directory...")"
154154

155155
cd "$ORIGINAL_PATH"
File renamed without changes.

0 commit comments

Comments
 (0)