ci: alias PR preview deployments to the PR number#57
Merged
Conversation
Cloudflare has no API or CLI to delete individual Worker versions, so PR preview deployments can't be cleaned up on merge/close. Using --preview-alias pins each PR to a stable, reused preview URL instead of minting a brand new version+URL on every push, which at least slows the buildup instead of one version per commit.
|
🚀 Preview deployed: https://pr-57-wibrow-dev.sam-wibrow.workers.dev |
deployment-url is the per-commit version URL, which still changes on every push even with --preview-alias set - the alias only shows up in wrangler's text output as "Version Preview Alias URL". Parse it out of command-output (via env, not string-interpolated into the script) so the PR comment actually gets the stable, reused link.
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.
Summary
--preview-alias pr-<number>to the PR deploy command so repeated pushes to the same PR reuse one stable preview URL instead of minting a new Worker version (and URL) on every commit.Context
Cloudflare doesn't expose an API or CLI to delete individual Worker versions (confirmed against the Workers Scripts Versions API and the beta Workers Versions API — both are list/get/create only, no delete), so this can't clean up existing orphaned preview versions, and merging/closing a PR still won't trigger any deletion. This just slows the rate new ones pile up.
Test plan