From c3c217593400432614b0aad7bb94ef2c723c3b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Thu, 13 Nov 2025 20:35:57 +0100 Subject: [PATCH 1/2] [Website] Remove "preview WordPress core branch" feature --- .../website/src/github/preview-pr/form.tsx | 17 +++++++++++++++-- .../website/src/github/preview-pr/modal.tsx | 10 +++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/playground/website/src/github/preview-pr/form.tsx b/packages/playground/website/src/github/preview-pr/form.tsx index c0b12fb7f2..3c86eb21d9 100644 --- a/packages/playground/website/src/github/preview-pr/form.tsx +++ b/packages/playground/website/src/github/preview-pr/form.tsx @@ -93,7 +93,15 @@ export default function PreviewPRForm({ if (prNumber.toLowerCase().includes(targetParams[target].pull)) { prNumber = prNumber.match(/\/pull\/(\d+)/)![1]; } else if (!/^\d+$/.test(prNumber)) { - // If it's not a number and not a PR URL, treat it as a branch name + // For WordPress core, only allow PR numbers/URLs, not branch names + if (target === 'wordpress') { + setError( + 'Please enter a valid PR number or PR URL for WordPress Core.' + ); + setSubmitting(false); + return; + } + // For Gutenberg, treat non-numeric input as a branch name branchName = prNumber; } @@ -217,6 +225,11 @@ export default function PreviewPRForm({ window.location.href = urlWithPreview.toString(); } + const inputLabel = + target === 'wordpress' + ? 'PR number or URL' + : 'PR number, URL, or a branch name'; + return (
@@ -227,7 +240,7 @@ export default function PreviewPRForm({ )} { diff --git a/packages/playground/website/src/github/preview-pr/modal.tsx b/packages/playground/website/src/github/preview-pr/modal.tsx index bd6173b873..17694b5ddc 100644 --- a/packages/playground/website/src/github/preview-pr/modal.tsx +++ b/packages/playground/website/src/github/preview-pr/modal.tsx @@ -18,12 +18,12 @@ export function PreviewPRModal({ target }: PreviewPRModalProps) { const closeModal = () => { dispatch(setActiveModal(null)); }; + const title = + target === 'wordpress' + ? `Preview a ${targetName[target]} PR` + : `Preview a ${targetName[target]} PR or Branch`; return ( - + ); From 62ef2fbc5a1b5208a91f387f2397625639249dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Thu, 13 Nov 2025 20:45:36 +0100 Subject: [PATCH 2/2] Remove mentions of core branches --- .../docs/developers/06-apis/query-api/01-index.md | 3 +-- .../website/src/github/preview-pr/form.tsx | 9 +++++---- .../src/lib/state/url/resolve-blueprint-from-url.ts | 13 ++++--------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/packages/docs/site/docs/developers/06-apis/query-api/01-index.md b/packages/docs/site/docs/developers/06-apis/query-api/01-index.md index cbcd32cce7..63ee8d3f20 100644 --- a/packages/docs/site/docs/developers/06-apis/query-api/01-index.md +++ b/packages/docs/site/docs/developers/06-apis/query-api/01-index.md @@ -41,8 +41,7 @@ You can go ahead and try it out. The Playground will automatically install the t | `language` | `en_US` | Sets the locale for the WordPress instance. This must be used in combination with `networking=yes` otherwise WordPress won't be able to download translations. | | `core-pr` | | Installs a specific https://github.com/WordPress/wordpress-develop core PR. Accepts the PR number. For example, `core-pr=6883`. | | `gutenberg-pr` | | Installs a specific https://github.com/WordPress/gutenberg PR. Accepts the PR number. For example, `gutenberg-pr=65337`. | -| `core-branch` | | Installs a specific branch from https://github.com/WordPress/wordpress-develop. Accepts the branch name. For example, `core-branch=trunk`. | -| `gutenberg-branch` | | Installs a specific branch from https://github.com/WordPress/gutenberg. Accepts the branch name. For example, `gutenberg-branch=trunk`. | +| `gutenberg-branch` | | Installs a specific branch from https://github.com/WordPress/gutenberg. Accepts the branch name. For example, `gutenberg-branch=trunk`. | | `if-stored-site-missing` | | Indicates how to handle the scenario where the `site-slug` parameter identifies a site that does not exist. Use `if-stored-site-missing=prompt` to indicate that the user should be asked whether they would like to save a new site with the specified `site-slug`. | For example, the following code embeds a Playground with a preinstalled Gutenberg plugin and opens the post editor: diff --git a/packages/playground/website/src/github/preview-pr/form.tsx b/packages/playground/website/src/github/preview-pr/form.tsx index 3c86eb21d9..5a204dbe7a 100644 --- a/packages/playground/website/src/github/preview-pr/form.tsx +++ b/packages/playground/website/src/github/preview-pr/form.tsx @@ -69,12 +69,13 @@ export default function PreviewPRForm({ function buildArtifactUrl(ref: string, isBranch: boolean): string { const refType = isBranch ? 'branch' : 'pr'; // For WordPress PRs: artifact name is wordpress-build-{PR_NUMBER} - // For WordPress branches: artifact name is wordpress-build-{COMMIT_HASH} - // We use wordpress-build- (with trailing dash) to trigger prefix matching - // For Gutenberg: artifact name is always gutenberg-plugin + // For Gutenberg PRs: artifact name is always gutenberg-plugin + // For Gutenberg branches: artifact name is always gutenberg-plugin + // (we use prefix matching with trailing dash for branches) let artifactSuffix = ''; if (target === 'wordpress') { - artifactSuffix = isBranch ? '-' : ref; + // WordPress only supports PRs, not branches + artifactSuffix = ref; } return `https://playground.wordpress.net/plugin-proxy.php?org=WordPress&repo=${targetParams[target].repo}&workflow=${targetParams[target].workflow}&artifact=${targetParams[target].artifact}${artifactSuffix}&${refType}=${ref}`; } diff --git a/packages/playground/website/src/lib/state/url/resolve-blueprint-from-url.ts b/packages/playground/website/src/lib/state/url/resolve-blueprint-from-url.ts index 2fc0b4500d..1e311aec6c 100644 --- a/packages/playground/website/src/lib/state/url/resolve-blueprint-from-url.ts +++ b/packages/playground/website/src/lib/state/url/resolve-blueprint-from-url.ts @@ -266,17 +266,12 @@ function applyQueryOverridesToDeclaration( }); } - // Handle WordPress core PR or branch preview - const coreRef = query.get('core-pr') || query.get('core-branch'); + // Handle WordPress core PR preview + const coreRef = query.get('core-pr'); if (coreRef) { - const refType = query.has('core-pr') ? 'pr' : 'branch'; // For WordPress PRs: artifact name is wordpress-build-{PR_NUMBER} - // For WordPress branches: artifact name is wordpress-build-{COMMIT_HASH} - // We use wordpress-build- (with trailing dash) to trigger prefix matching in plugin-proxy.php - const artifactName = query.has('core-pr') - ? `wordpress-build-${coreRef}` - : 'wordpress-build-'; - blueprint.preferredVersions!.wp = `https://playground.wordpress.net/plugin-proxy.php?org=WordPress&repo=wordpress-develop&workflow=Test%20Build%20Processes&artifact=${artifactName}&${refType}=${coreRef}`; + const artifactName = `wordpress-build-${coreRef}`; + blueprint.preferredVersions!.wp = `https://playground.wordpress.net/plugin-proxy.php?org=WordPress&repo=wordpress-develop&workflow=Test%20Build%20Processes&artifact=${artifactName}&pr=${coreRef}`; } // Handle Gutenberg PR or branch preview