-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a secret message #47739
base: trunk
Are you sure you want to change the base?
Add a secret message #47739
Conversation
Flaky tests detected in 86aedc0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4084941710
|
## Description Adds support for previewing Gutenberg Pull Requests via the a `gutenberg-pr` query parameter: https://playground.wordpress.net/wordpress.html?gutenberg-pr=47739&url=/wp-admin/plugins.php?test=test My test PR: WordPress/gutenberg#47739 <img width="1149" alt="CleanShot 2023-02-03 at 19 33 17@2x" src="https://user-images.githubusercontent.com/205419/216681315-2af555c1-6249-4758-afe0-aa54b66c68a3.png"> ## Implementation The plugin bundle is downloaded from GitHub CI and installed by applying the following Blueprint: ```js function applyGutenbergPRSteps(prNumber: number): StepDefinition[] { return [ { step: 'mkdir', path: '/wordpress/pr', }, { step: 'writeFile', path: '/wordpress/pr/pr.zip', data: { resource: 'url', url: `/plugin-proxy?org=WordPress&repo=gutenberg&workflow=Build%20Gutenberg%20Plugin%20Zip&artifact=gutenberg-plugin&pr=${prNumber}`, caption: `Downloading Gutenberg PR ${prNumber}`, }, progress: { weight: 2, caption: `Applying Gutenberg PR ${prNumber}`, }, }, { step: 'unzip', zipPath: '/wordpress/pr/pr.zip', extractToPath: '/wordpress/pr', }, { step: 'installPlugin', pluginZipFile: { resource: 'vfs', path: '/wordpress/pr/gutenberg.zip', }, }, ]; } ``` Gutenberg PR preview from playground.wordpress.net can be embedded in other apps via an iframe. To implement your own PR previewer that pulls data from another repo, you'll need to expose an API endpoint to download the ZIP bundle and then plug it in the `writeFile` step above. Once you have that, here's how you'd apply a custom blueprint: ```ts import { startPlaygroundWeb } from "https://unpkg.com/@wp-playground/[email protected]/index.js"; startPlaygroundWeb({ iframe, remoteUrl: `https://playground.wordpress.net/remote.html`, blueprint: { steps: applyPR( 47339 ) } }) function applyPR( prNumber ) { return [ { step: 'mkdir', path: '/wordpress/pr', }, // ... ]; } ```
## Description Adds support for previewing Gutenberg Pull Requests via the a `gutenberg-pr` query parameter: https://playground.wordpress.net/wordpress.html?gutenberg-pr=47739&url=/wp-admin/plugins.php?test=test My test PR: WordPress/gutenberg#47739 <img width="1149" alt="CleanShot 2023-02-03 at 19 33 17@2x" src="https://user-images.githubusercontent.com/205419/216681315-2af555c1-6249-4758-afe0-aa54b66c68a3.png"> ## Implementation The plugin bundle is downloaded from GitHub CI and installed by applying the following Blueprint: ```js function applyGutenbergPRSteps(prNumber: number): StepDefinition[] { return [ { step: 'mkdir', path: '/wordpress/pr', }, { step: 'writeFile', path: '/wordpress/pr/pr.zip', data: { resource: 'url', url: `/plugin-proxy?org=WordPress&repo=gutenberg&workflow=Build%20Gutenberg%20Plugin%20Zip&artifact=gutenberg-plugin&pr=${prNumber}`, caption: `Downloading Gutenberg PR ${prNumber}`, }, progress: { weight: 2, caption: `Applying Gutenberg PR ${prNumber}`, }, }, { step: 'unzip', zipPath: '/wordpress/pr/pr.zip', extractToPath: '/wordpress/pr', }, { step: 'installPlugin', pluginZipFile: { resource: 'vfs', path: '/wordpress/pr/gutenberg.zip', }, }, ]; } ``` Gutenberg PR preview from playground.wordpress.net can be embedded in other apps via an iframe. To implement your own PR previewer that pulls data from another repo, you'll need to expose an API endpoint to download the ZIP bundle and then plug it in the `writeFile` step above. Once you have that, here's how you'd apply a custom blueprint: ```ts import { startPlaygroundWeb } from "https://unpkg.com/@wp-playground/[email protected]/index.js"; startPlaygroundWeb({ iframe, remoteUrl: `https://playground.wordpress.net/remote.html`, blueprint: { steps: applyPR( 47339 ) } }) function applyPR( prNumber ) { return [ { step: 'mkdir', path: '/wordpress/pr', }, // ... ]; } ```
Fixes the Playground example embedded in [this documentation page](https://wordpress.github.io/wordpress-playground/build-your-first-app#preview-pull-requests-from-your-repository), which didn't load. ## How is the problem addressed? 1. Resolved the errors displayed in the browser console. 2. Updated the Blueprint based on the [code of the official Previewer](https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/website/public/gutenberg.html). 3. Replaced [the PR](WordPress/gutenberg#60819) loaded in the example. ### Why step 3? It seems that there's an unrelated problem with [the specific PR used](WordPress/gutenberg#47739) in the demo: 1. It doesn't work when loading it directly in the [Gutenberg PR Previewer](https://playground.wordpress.net/gutenberg.html). 2. Other random PRs load correctly in the example. Using 60819 can be a temporary workaround. ## Testing Instructions 1. Run `nx dev docs-site`. 2. Go to [this documentation page](https://wordpress.github.io/wordpress-playground/build-your-first-app#preview-pull-requests-from-your-repository). 4. Scroll a bit, and click the **Try it now** button.
@adamziel, can we close this PR? |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Adds a secret message in wp-admin:
Try it here: https://playground.wordpress.net/wordpress.html?gutenberg-pr=47739&php=7.4&url=/wp-admin/plugins.php?test=42test
(Please ignore this test Pull Request)