-
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
Open
adamziel
wants to merge
9
commits into
trunk
Choose a base branch
from
try/test-pr-for-playground-preview
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add a secret message #47739
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Flaky tests detected in 86aedc0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4084941710
|
This was referenced Feb 3, 2023
adamziel
added a commit
to WordPress/wordpress-playground
that referenced
this pull request
Apr 26, 2023
## 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/client@0.1.32/index.js"; startPlaygroundWeb({ iframe, remoteUrl: `https://playground.wordpress.net/remote.html`, blueprint: { steps: applyPR( 47339 ) } }) function applyPR( prNumber ) { return [ { step: 'mkdir', path: '/wordpress/pr', }, // ... ]; } ```
adamziel
commented
Apr 28, 2023
adamziel
commented
Apr 28, 2023
adamziel
commented
Apr 29, 2023
Pookie717
added a commit
to Pookie717/wordpress-playground
that referenced
this pull request
Oct 1, 2023
## 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/client@0.1.32/index.js"; startPlaygroundWeb({ iframe, remoteUrl: `https://playground.wordpress.net/remote.html`, blueprint: { steps: applyPR( 47339 ) } }) function applyPR( prNumber ) { return [ { step: 'mkdir', path: '/wordpress/pr', }, // ... ]; } ```
adamziel
pushed a commit
to WordPress/wordpress-playground
that referenced
this pull request
Apr 19, 2024
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)