Skip to content

Commit

Permalink
Add core-pr and gutenberg-pr Query API parameters (#1761)
Browse files Browse the repository at this point in the history
Enables easy mixing of WordPress and Gutenberg Pull Requests via Query
API parameters. For example:

https://playground.wordpress.net/?core-pr=6883&gutenberg-pr=65337

These parameters work even when a Blueprint is specified and take
precedence over the WordPress version specified by the Blueprint

 ## Testing instructions

1. Go to
http://localhost:5400/website-server/?core-pr=6883&gutenberg-pr=65337
2. Confirm the WordPress release is a development version (in wp-admin,
bottom right
   corner)
3. Confirm the Gutenberg plugin is installed## Motivation for the
change, related issues
4. Confirm the Gutenberg PR previewer at
http://localhost:5400/website-server/gutenberg.html still works
5. Confirm the WordPress PR previewer at
http://localhost:5400/website-server/wordpress.html still works
  • Loading branch information
adamziel authored Oct 7, 2024
1 parent 7cbbd8c commit d2de3c0
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 104 deletions.
49 changes: 23 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,89 +4,86 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v0.9.46] (2024-10-07)
## [v0.9.46] (2024-10-07)

### Enhancements

- Webapp upgrade protocol: Disable HTTP caching and reload other browser tabs to prevent fatal errors after new deployments. ([#1822](https://github.com/WordPress/wordpress-playground/pull/1822))
- Webapp upgrade protocol: Disable HTTP caching and reload other browser tabs to prevent fatal errors after new deployments. ([#1822](https://github.com/WordPress/wordpress-playground/pull/1822))

### Documentation

- Docs: Disable localeDropdown until more pages are translated. ([#1824](https://github.com/WordPress/wordpress-playground/pull/1824))
- Docs: Review playground documentation translations page. ([#1826](https://github.com/WordPress/wordpress-playground/pull/1826))
- Docs: Playground PR previews through GitHub actions. ([#1825](https://github.com/WordPress/wordpress-playground/pull/1825))
- Docs: Disable localeDropdown until more pages are translated. ([#1824](https://github.com/WordPress/wordpress-playground/pull/1824))
- Docs: Review playground documentation translations page. ([#1826](https://github.com/WordPress/wordpress-playground/pull/1826))
- Docs: Playground PR previews through GitHub actions. ([#1825](https://github.com/WordPress/wordpress-playground/pull/1825))

### Website

- Use site slug as a stable scope. ([#1839](https://github.com/WordPress/wordpress-playground/pull/1839))
- Close Playground Manager by default. ([#1831](https://github.com/WordPress/wordpress-playground/pull/1831))
- Fix go-to-site menu items to reveal site view. ([#1833](https://github.com/WordPress/wordpress-playground/pull/1833))
- Use site slug as a stable scope. ([#1839](https://github.com/WordPress/wordpress-playground/pull/1839))
- Close Playground Manager by default. ([#1831](https://github.com/WordPress/wordpress-playground/pull/1831))
- Fix go-to-site menu items to reveal site view. ([#1833](https://github.com/WordPress/wordpress-playground/pull/1833))

### Various

- Add Install instructions to the Playwright README. ([#1837](https://github.com/WordPress/wordpress-playground/pull/1837))
- Resolve end-to-end failures. ([#1844](https://github.com/WordPress/wordpress-playground/pull/1844))
- Add Install instructions to the Playwright README. ([#1837](https://github.com/WordPress/wordpress-playground/pull/1837))
- Resolve end-to-end failures. ([#1844](https://github.com/WordPress/wordpress-playground/pull/1844))

### Contributors

The following contributors merged PRs in this release:

@adamziel @akirk @brandonpayton @juanmaguitar


## [v0.9.45] (2024-09-30)
## [v0.9.45] (2024-09-30)

### Blueprints

- Translate GitHub.com file URLs into CORS-accessible raw.githubusercontent.com. ([#1810](https://github.com/WordPress/wordpress-playground/pull/1810))
- Translate GitHub.com file URLs into CORS-accessible raw.githubusercontent.com. ([#1810](https://github.com/WordPress/wordpress-playground/pull/1810))

### Tools

- [UX] Stored Playgrounds (no more data loss), multiple Playgrounds, UI WebApp Redesign. ([#1731](https://github.com/WordPress/wordpress-playground/pull/1731))
- [UX] Stored Playgrounds (no more data loss), multiple Playgrounds, UI WebApp Redesign. ([#1731](https://github.com/WordPress/wordpress-playground/pull/1731))

### Documentation

- Docs: Translation i18n messages - JSON files. ([#1807](https://github.com/WordPress/wordpress-playground/pull/1807))
- Docs: Translation i18n messages - JSON files. ([#1807](https://github.com/WordPress/wordpress-playground/pull/1807))

### Website

- Prevent creation of two temporary sites. ([#1817](https://github.com/WordPress/wordpress-playground/pull/1817))
- Stop address bar from adding trailing slash to query params. ([#1820](https://github.com/WordPress/wordpress-playground/pull/1820))
- Prevent creation of two temporary sites. ([#1817](https://github.com/WordPress/wordpress-playground/pull/1817))
- Stop address bar from adding trailing slash to query params. ([#1820](https://github.com/WordPress/wordpress-playground/pull/1820))

### Bug Fixes

- Fix broken Playwright tests. ([#1819](https://github.com/WordPress/wordpress-playground/pull/1819))
- Fix broken Playwright tests. ([#1819](https://github.com/WordPress/wordpress-playground/pull/1819))

### Various

- Add Playwright tests for UI redesign changes. ([#1769](https://github.com/WordPress/wordpress-playground/pull/1769))
- Docs: Contributions to translations. ([#1808](https://github.com/WordPress/wordpress-playground/pull/1808))
- Add Playwright tests for UI redesign changes. ([#1769](https://github.com/WordPress/wordpress-playground/pull/1769))
- Docs: Contributions to translations. ([#1808](https://github.com/WordPress/wordpress-playground/pull/1808))

### Contributors

The following contributors merged PRs in this release:

@adamziel @bgrgicak @brandonpayton @juanmaguitar


## [v0.9.44] (2024-09-24)
## [v0.9.44] (2024-09-24)

### Bug Fixes

- Docs: Fix links intro fr. ([#1795](https://github.com/WordPress/wordpress-playground/pull/1795))
- Docs: Fix links intro fr. ([#1795](https://github.com/WordPress/wordpress-playground/pull/1795))

### Various

- Add missing functions required to succesfully connect with MySQL DB. ([#1752](https://github.com/WordPress/wordpress-playground/pull/1752))
- Add missing functions required to succesfully connect with MySQL DB. ([#1752](https://github.com/WordPress/wordpress-playground/pull/1752))

### Contributors

The following contributors merged PRs in this release:

@jeroenpf @juanmaguitar


## [v0.9.43] (2024-09-23)
## [v0.9.43] (2024-09-23)

### Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ You can go ahead and try it out. The Playground will automatically install the t
| `import-wxr` | | Imports site content from a WXR file specified by a URL. It uses the WordPress Importer plugin, so the default admin user must be logged in. |
| `site-slug` | | Selects which site to load from browser storage. |
| `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`. |

For example, the following code embeds a Playground with a preinstalled Gutenberg plugin and opens the post editor:

Expand Down
49 changes: 23 additions & 26 deletions packages/docs/site/docs/main/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,86 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v0.9.46] (2024-10-07)
## [v0.9.46] (2024-10-07)

### Enhancements

- Webapp upgrade protocol: Disable HTTP caching and reload other browser tabs to prevent fatal errors after new deployments. ([#1822](https://github.com/WordPress/wordpress-playground/pull/1822))
- Webapp upgrade protocol: Disable HTTP caching and reload other browser tabs to prevent fatal errors after new deployments. ([#1822](https://github.com/WordPress/wordpress-playground/pull/1822))

### Documentation

- Docs: Disable localeDropdown until more pages are translated. ([#1824](https://github.com/WordPress/wordpress-playground/pull/1824))
- Docs: Review playground documentation translations page. ([#1826](https://github.com/WordPress/wordpress-playground/pull/1826))
- Docs: Playground PR previews through GitHub actions. ([#1825](https://github.com/WordPress/wordpress-playground/pull/1825))
- Docs: Disable localeDropdown until more pages are translated. ([#1824](https://github.com/WordPress/wordpress-playground/pull/1824))
- Docs: Review playground documentation translations page. ([#1826](https://github.com/WordPress/wordpress-playground/pull/1826))
- Docs: Playground PR previews through GitHub actions. ([#1825](https://github.com/WordPress/wordpress-playground/pull/1825))

### Website

- Use site slug as a stable scope. ([#1839](https://github.com/WordPress/wordpress-playground/pull/1839))
- Close Playground Manager by default. ([#1831](https://github.com/WordPress/wordpress-playground/pull/1831))
- Fix go-to-site menu items to reveal site view. ([#1833](https://github.com/WordPress/wordpress-playground/pull/1833))
- Use site slug as a stable scope. ([#1839](https://github.com/WordPress/wordpress-playground/pull/1839))
- Close Playground Manager by default. ([#1831](https://github.com/WordPress/wordpress-playground/pull/1831))
- Fix go-to-site menu items to reveal site view. ([#1833](https://github.com/WordPress/wordpress-playground/pull/1833))

### Various

- Add Install instructions to the Playwright README. ([#1837](https://github.com/WordPress/wordpress-playground/pull/1837))
- Resolve end-to-end failures. ([#1844](https://github.com/WordPress/wordpress-playground/pull/1844))
- Add Install instructions to the Playwright README. ([#1837](https://github.com/WordPress/wordpress-playground/pull/1837))
- Resolve end-to-end failures. ([#1844](https://github.com/WordPress/wordpress-playground/pull/1844))

### Contributors

The following contributors merged PRs in this release:

@adamziel @akirk @brandonpayton @juanmaguitar


## [v0.9.45] (2024-09-30)
## [v0.9.45] (2024-09-30)

### Blueprints

- Translate GitHub.com file URLs into CORS-accessible raw.githubusercontent.com. ([#1810](https://github.com/WordPress/wordpress-playground/pull/1810))
- Translate GitHub.com file URLs into CORS-accessible raw.githubusercontent.com. ([#1810](https://github.com/WordPress/wordpress-playground/pull/1810))

### Tools

- [UX] Stored Playgrounds (no more data loss), multiple Playgrounds, UI WebApp Redesign. ([#1731](https://github.com/WordPress/wordpress-playground/pull/1731))
- [UX] Stored Playgrounds (no more data loss), multiple Playgrounds, UI WebApp Redesign. ([#1731](https://github.com/WordPress/wordpress-playground/pull/1731))

### Documentation

- Docs: Translation i18n messages - JSON files. ([#1807](https://github.com/WordPress/wordpress-playground/pull/1807))
- Docs: Translation i18n messages - JSON files. ([#1807](https://github.com/WordPress/wordpress-playground/pull/1807))

### Website

- Prevent creation of two temporary sites. ([#1817](https://github.com/WordPress/wordpress-playground/pull/1817))
- Stop address bar from adding trailing slash to query params. ([#1820](https://github.com/WordPress/wordpress-playground/pull/1820))
- Prevent creation of two temporary sites. ([#1817](https://github.com/WordPress/wordpress-playground/pull/1817))
- Stop address bar from adding trailing slash to query params. ([#1820](https://github.com/WordPress/wordpress-playground/pull/1820))

### Bug Fixes

- Fix broken Playwright tests. ([#1819](https://github.com/WordPress/wordpress-playground/pull/1819))
- Fix broken Playwright tests. ([#1819](https://github.com/WordPress/wordpress-playground/pull/1819))

### Various

- Add Playwright tests for UI redesign changes. ([#1769](https://github.com/WordPress/wordpress-playground/pull/1769))
- Docs: Contributions to translations. ([#1808](https://github.com/WordPress/wordpress-playground/pull/1808))
- Add Playwright tests for UI redesign changes. ([#1769](https://github.com/WordPress/wordpress-playground/pull/1769))
- Docs: Contributions to translations. ([#1808](https://github.com/WordPress/wordpress-playground/pull/1808))

### Contributors

The following contributors merged PRs in this release:

@adamziel @bgrgicak @brandonpayton @juanmaguitar


## [v0.9.44] (2024-09-24)
## [v0.9.44] (2024-09-24)

### Bug Fixes

- Docs: Fix links intro fr. ([#1795](https://github.com/WordPress/wordpress-playground/pull/1795))
- Docs: Fix links intro fr. ([#1795](https://github.com/WordPress/wordpress-playground/pull/1795))

### Various

- Add missing functions required to succesfully connect with MySQL DB. ([#1752](https://github.com/WordPress/wordpress-playground/pull/1752))
- Add missing functions required to succesfully connect with MySQL DB. ([#1752](https://github.com/WordPress/wordpress-playground/pull/1752))

### Contributors

The following contributors merged PRs in this release:

@jeroenpf @juanmaguitar


## [v0.9.43] (2024-09-23)
## [v0.9.43] (2024-09-23)

### Documentation

Expand Down
53 changes: 2 additions & 51 deletions packages/playground/website/public/gutenberg.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,56 +165,6 @@
username: 'admin',
password: 'password',
},
{
step: 'mkdir',
path: '/wordpress/pr',
},
/*
* This is the most important step.
* It download the built plugin zip file exposed by GitHub CI.
*
* Because the zip file is not publicly accessible, we use the
* plugin-proxy API endpoint to download it. The source code of
* that endpoint is available at:
* https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/website/public/plugin-proxy.php
*/
{
step: 'writeFile',
path: '/wordpress/pr/pr.zip',
data: {
resource: 'url',
url: zipArtifactUrl,
caption: `Downloading Gutenberg PR ${prNumber}`,
},
progress: {
weight: 2,
caption: `Applying Gutenberg PR ${prNumber}`,
},
},
/**
* GitHub CI artifacts are doubly zipped:
*
* pr.zip
* gutenberg.zip
* gutenberg.php
* ... other files ...
*
* This step extracts the inner zip file so that we get
* access directly to gutenberg.zip and can use it to
* install the plugin.
*/
{
step: 'unzip',
zipPath: '/wordpress/pr/pr.zip',
extractToPath: '/wordpress/pr',
},
{
step: 'installPlugin',
pluginZipFile: {
resource: 'vfs',
path: '/wordpress/pr/gutenberg.zip',
},
},
],
};
// If there's a import-site query parameter, pass that to the blueprint
Expand All @@ -236,7 +186,8 @@
}

const encoded = JSON.stringify(blueprint);
window.location = '/#' + encodeURI(encoded);
window.location =
'./?gutenberg-pr=' + prNumber + '#' + encodeURI(encoded);
}
</script>
</body>
2 changes: 1 addition & 1 deletion packages/playground/website/public/wordpress.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@
login: true,
preferredVersions: {
php: '7.4',
wp: zipArtifactUrl,
},
features: {
networking: true,
Expand All @@ -233,6 +232,7 @@
if (urlParams.has('mode')) {
targetParams.set('mode', urlParams.get('mode'));
}
targetParams.set('core-pr', prNumber);
window.location =
'./?' + targetParams.toString() + '#' + encodeURI(encoded);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,54 @@ export async function resolveBlueprintFromURL(url: URL) {
});
}

if (query.has('core-pr')) {
const prNumber = query.get('core-pr');
blueprint.preferredVersions!.wp = `https://playground.wordpress.net/plugin-proxy.php?org=WordPress&repo=wordpress-develop&workflow=Test%20Build%20Processes&artifact=wordpress-build-${prNumber}&pr=${prNumber}`;
}

if (query.has('gutenberg-pr')) {
const prNumber = query.get('gutenberg-pr');
blueprint.steps = blueprint.steps || [];
blueprint.steps.unshift(
{
step: 'mkdir',
path: '/tmp/pr',
},
{
step: 'writeFile',
path: '/tmp/pr/pr.zip',
data: {
resource: 'url',
url: `/plugin-proxy.php?org=WordPress&repo=gutenberg&workflow=Build%20Gutenberg%20Plugin%20Zip&artifact=gutenberg-plugin&pr=${prNumber}`,
caption: `Downloading Gutenberg PR ${prNumber}`,
},
},
/**
* GitHub CI artifacts are doubly zipped:
*
* pr.zip
* gutenberg.zip
* gutenberg.php
* ... other files ...
*
* This step extracts the inner zip file so that we get
* access directly to gutenberg.zip and can use it to
* install the plugin.
*/
{
step: 'unzip',
zipPath: '/tmp/pr/pr.zip',
extractToPath: '/tmp/pr',
},
{
step: 'installPlugin',
pluginZipFile: {
resource: 'vfs',
path: '/tmp/pr/gutenberg.zip',
},
}
);
}

return blueprint;
}

0 comments on commit d2de3c0

Please sign in to comment.