TRAC-969: Create reusable preview deployment action - #3194
Open
jordanarldt wants to merge 11 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: 39883cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jordanarldt
force-pushed
the
TRAC-969
branch
2 times, most recently
from
August 26, 2026 18:28
2a99903 to
74462d0
Compare
Contributor
Bundle Size ReportComparing against baseline from No bundle size changes detected. |
Contributor
Unlighthouse Performance Comparison — VercelComparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores. Summary ScoreAggregate score across all categories as reported by Unlighthouse.
Category Scores
Core Web Vitals
|
…nd update documentation
…cess and documentation
…vironment variables for configuration and update documentation
…andling for preview deployments
jordanarldt
force-pushed
the
TRAC-969
branch
from
September 1, 2026 18:35
5e8228e to
800df79
Compare
jordanarldt
force-pushed
the
TRAC-969
branch
from
September 2, 2026 15:28
0da1e66 to
6b275bd
Compare
…ter it deploys A redeploy looked up its check run by name, which on a commit that had already auto-deployed found the row GitHub manages for the job itself. GitHub refuses API changes to those, and gh writes the refusal to stdout, so the 403 body was captured as the check run id. Every later request built a URL out of that JSON and failed, turning a run red after it had deployed, announced the preview and reacted to the command. Claim rows with an external_id and only ever update those; name the row for the command rather than the job, so the two cannot collide. Filter every captured id to digits, since a refused request leaves JSON, not nothing. Treat both closing patches as bookkeeping. The failure handler patched before commenting, so a redeploy that genuinely failed left no comment at all. Refs TRAC-969 Co-Authored-By: Claude <noreply@anthropic.com>
…edeploy Reusing the previous redeploy's row looked right and did nothing. A check run belongs to the workflow run that created it; another run's PATCH returns 200 and changes no field. Polling the row through a redeploy showed it sitting on the previous result for the whole run, so the yellow in-progress check the command is supposed to give never appeared on a repeat redeploy of the same commit. Always POST. GitHub lists only the newest row per name, so the superseded rows do not pile up, and the run that opened a row is the one that closes it. Refs TRAC-969 Co-Authored-By: Claude <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.
Jira: TRAC-969
What/Why?
Adds
packages/deployment-preview-action, a GitHub Action that deploys a preview of a pull request to BigCommerce native hosting and keeps the PR comments describing it accurate.core/.github/ships a ready-to-use workflow, so scaffolded storefronts get previews without writing one.Three decisions worth knowing before reading the diff:
All previews share one hosting project. Native hosting assigns a hostname per project, not per deployment, so a second deploy replaces the first at the same URL. The project serves one PR at a time, which is why there is arbitration at all. The newest open PR deploys on push; any other takes the preview over by commenting
redeploy preview. A PR that loses the preview gets its comment rewritten, so no thread advertises a URL that now serves someone else's code.Shipped as both an action and a reusable workflow. A workflow can declare
concurrency,permissionsandenvironment; an action cannot. The concurrency group is load-bearing here — two deploys at once would race for the shared project — so the reusable wrapper is the recommended entry point andcore/uses it.The comment path builds PR code with the store's deploy credentials. Write-permission and same-repo checks run before checkout, so nothing untrusted is fetched, let alone executed by
pnpm install. These live inside the action rather than in copy-pasteable YAML so they can't be omitted by mistake.Unconfigured repositories skip silently rather than failing, so a freshly scaffolded storefront doesn't get a red X on its first PR.
Testing
pnpm --filter @bigcommerce/deployment-preview-action test43 tests against a stubbed BigCommerce and GitHub API — no credentials or network needed. They cover the deploy-eligibility rules, which comment updates notify vs. stay silent, and
action.ymlitself (everyrunblock is syntax-checked, since nothing compiles it).Verified end to end against a real store: auto-deploy on the newest PR, deferral on an older one,
redeploy previewtakeover, and the comment rewrite on the displaced PR.Migration
None for existing projects. Previews stay off until configured with a
PREVIEW_DEPLOYMENT_PROJECT_UUIDvariable and the store credentials — see the package README.