-
Notifications
You must be signed in to change notification settings - Fork 275
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
Allow specifying a WordPres/WordPress branch and pulling from GitHub. #1705
Conversation
7373817
to
cea0d9a
Compare
That's lovely @peterwilsoncc, thank you! I only left a few minor notes. Hey, @dmsnell @sirreal, you'll like this one! It's one step closer to a |
Co-authored-by: Adam Zieliński <adam@adamziel.com>
I've renamed the parameter in 7179bf6. Something that's occurred to me since opening this is that it would be possible to also accept:
Would you like me to add either or both of those? |
Oh, nice! That would be lovely! I'll merge this PR to make the feature available already, and let's explore that in a follow-up. |
## Motivation for the change, related issues This extends the allowable resources available via the `wordpress-branch` query string parameter to include all available resources. I've also improved the robustness of the code by getting the location header from the official URL rather than the destination URL. Follow up to #1705. ## Implementation details Which resource to download is determined by the the form the `wordpress-branch` parameter: * the HEAD of any branch in the form x.x or x.x-branch, * a specific tag in the form x.x.x, normalizing the value for major releases, * a specific commit in the form [a-z0-9]{7,40} To allow for the querying of the location header, I've needed to make the `PluginDownloader::gitHubRequest()` method public. If there is an alternative approach, please let me know. ## Testing Instructions (or ideally a Blueprint) In the command line run the following commands: ``` PLAYGROUND_URL=http://localhost:9999 npx nx run playground-website:build:wasm-wordpress-net php -S localhost:9999 -t dist/packages/playground/wasm-wordpress-net ``` Blueprint configs using the localhost: * [trunk](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=trunk%22%7D%7D) * [HEAD of the 6.6 branch using `wordpress-branch=6.6`](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=6.6%22%7D%7D) * [HEAD of the 6.6 branch using `wordpress-branch=6.6-branch`](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=6.6-branch%22%7D%7D) * [6.6 major release](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=6.6.0%22%7D%7D) * [6.5.2 minor release](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=6.5.2%22%7D%7D) * WordPress/WordPress@b8dbab9 using [the long form hash](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=b8dbab954688836bafc72457a21300380e96078a%22%7D%7D) * Above using a [short form hash](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=b8dbab9546%22%7D%7D) * [an invalid resource `puppies-and-kittens`](http://localhost:9999/?#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22,%22wp%22:%22http://localhost:9999/plugin-proxy.php?wordpress-branch=puppiesandkittens%22%7D%7D)
Motivation for the change, related issues
As a Core contributor, it can be helpful to pull in
trunk
or the head of another branch to test changes before they are tagged, released or appear in a nightly. This is especially the case for older branches that do not have nightly builds.This allows for the pulling in of a zip from the GitHub build repository.
Implementation details
Update to
plugin-proxy.php
branch
trunk
andmaster
as the head of the repox.x
andx.x-branch
as the head of the specified branchUpdate to
unzipWordPress()
wp-config-sample.php
Testing Instructions (or ideally a Blueprint)
PLAYGROUND_URL=http://localhost:9999 npx nx run playground-website:build:wasm-wordpress-net
php -S localhost:9999 -t dist/packages/playground/wasm-wordpress-net