Repository navigation
Add a "Test the build" comment to pull requests - #588
Merged
Merged
Conversation
Trying the code of a pull request meant checking the branch out and running the build locally. The only workflow that builds an installable zip, generate-zip.yml, runs on demand or for QIT, and nothing told a reviewer where to get its output. A reviewer without a development environment, a designer for example, had no way in at all. Build the zip on every pull request and post one comment, updated on each push, with the ways to try that build: - WordPress Playground: two links that open a store with WooCommerce and the build in the visitor's browser, one on the Square settings and one on the onboarding wizard. The Blueprint skips WooCommerce's setup wizard, opens the store, turns HPOS on and adds a sample product, so there is nothing to do by hand first. Signing in to Square has to redirect back to the site, and a site in a browser tab has no public address, so the comment says the previews cannot connect, take payments, sync products or receive webhooks. - Jetpack Beta and Jurassic Ninja: both are served by the Jetpack Beta Builder, which only takes builds from plugins registered with it. This plugin is not registered yet, so those two options and the webhook call are left out until the SQUARE_LIVE_BRANCH_SECRET secret exists. Nothing else has to change once it does. Jurassic Ninja redirects its create URL to its homepage for visitors who are not logged in, so that option says to log in first. The work is split in two jobs. The first runs the pull request's build scripts and its dependencies' install scripts with a read-only token and no secrets. The second holds the secret and the token that can comment, and runs no code from the pull request. Playground's artifact proxy picks a build by branch name, forks included, so a link cannot promise whose code it runs. The Blueprints carry no secret and the comment tells visitors not to enter Square tokens in a preview. The preview artifact is named after the run ID, so a link always installs the build of the run that wrote it, and is kept for 14 days because the links download it on every click. Pull requests from forks get a read-only token and cannot be commented on from a pull_request workflow. Their build information goes to the summary of the workflow run instead. The workflow lives under .github, which is export-ignored, so nothing here ships in the release zip. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The "Test the build" comment said under the Jurassic Ninja link that the reader has to be logged in. Jurassic Ninja redirects its create URL to its homepage for anyone who is not, so a reader who clicks first and reads second lands on a page that launches nothing and has no hint why. Say it before the link, as a warning, in the words the same comment uses in the other Woo extensions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The comment left Jetpack Beta and Jurassic Ninja out while the plugin is not registered with the Jetpack Beta Builder, and renumbered WordPress Playground as Option 1. A reader who knows the comment from another Woo extension could not tell whether those two options were missing by mistake, unsupported, or waiting on something. Always write the same three options in the same order. While the workflow has no SQUARE_LIVE_BRANCH_SECRET, Options 1 and 2 keep their heading and say that they are not available yet and what they need, with no link, since a link could not work. Each option that does work now also says what its limit is for this plugin: Jetpack Beta runs the build with the settings and the Square connection the site already has, so it belongs on a test site; a Jurassic Ninja site starts without a Square connection. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This is linked to GitHub issue #589. |
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Test the buildWordPress Playground - runs in your browser
ℹ️ Neither can connect to Square: signing in to Square has to send you back to the site, and a site that runs in your browser tab has no public address to come back to. Without a connection the store cannot take payments, sync products or receive webhooks, so the previews show what a merchant sees before connecting. Do not enter Square access tokens or other credentials in a preview. The links stop working 14 days after the last build. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
… the build" comment The comment listed three options. Jetpack Beta and Jurassic Ninja were rendered as "Not available yet", because both install a pull request's build through the Jetpack Beta Builder and this plugin is not registered with it. The workflow also carried the steps for them: a webhook call behind a repository secret that does not exist, a second artifact named for the Beta Builder, and a `-dev` folder name and `Stable tag` bump that only the Beta Builder reads. A section that only says an option is unavailable gives a reviewer nothing to click, and steps wired to a missing secret are dead code. Show only what works today: the WordPress Playground previews, under a heading that names them instead of "Option 3". Drop the Beta Builder steps, the extra artifact and the secret reference. The remaining artifact now holds the zip exactly as `npm run build` produces it, so the Blueprints install `woocommerce-square.zip`. The two jobs stay separate: the first runs the pull request's code with a read-only token, the second holds the token that can comment. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or 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
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.
All Submissions:
Changes proposed in this Pull Request:
To try a pull request you had to check out the branch and build it. A workflow now builds the zip on each pull request and posts a "Test the build" comment with two WordPress Playground previews, which cannot connect to Square; fork pull requests get it in the run summary. Jetpack Beta and Jurassic Ninja are not included, because the plugin is not registered with the Jetpack Beta Builder.
Steps to test the changes in this Pull Request:
Changelog entry
🤖 Generated with Claude Code
Closes #589