[Pages] Add PowerShell deployment cleanup script example#32273
Open
MattieTK wants to merge 5 commits into
Open
[Pages] Add PowerShell deployment cleanup script example#32273MattieTK wants to merge 5 commits into
MattieTK wants to merge 5 commits into
Conversation
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
|
Preview URL: https://6fcac6ff.preview.developers.cloudflare.com Files with changes (up to 15) |
MattieTK
marked this pull request as ready for review
July 23, 2026 16:34
MattieTK
requested review from
a team,
GregBrimble,
WalshyDev,
aninibread and
irvinebroque
as code owners
July 23, 2026 16:34
Contributor
Review💡 2 suggestions found in commit 👉 Fix in your agent 👈Fix the following review findings in PR #32273 (https://github.com/cloudflare/cloudflare-docs/pull/32273).
Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.
The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.
---
## Code Review
### Suggestions (2)
#### CR-027d60504947 · Unquoted native-command arguments
- **File:** `src/content/docs/pages/platform/known-issues.mdx` line 186
- **Issue:** The PowerShell script invokes `npx ... wrangler pages deployment delete $id ... --project-name $using:ProjectName` without quoting `$id` or `$using:ProjectName`, so any value containing spaces would be split into multiple arguments.
- **Fix:** Quote the command arguments: `npx --no-install wrangler pages deployment delete "$id" --project-name "$using:ProjectName" --force *> $null`.
#### CR-4a42ccd3e14a · Redundant environment-variable assignment
- **File:** `src/content/docs/pages/platform/known-issues.mdx` line 165
- **Issue:** `$env:CLOUDFLARE_ACCOUNT_ID = $env:CLOUDFLARE_ACCOUNT_ID` reassigns the variable to its current value (or null to null) and does not actually ensure inheritance into parallel runspaces.
- **Fix:** Remove the line and its comment, or replace it with a clearer note that environment variables are already inherited by `ForEach-Object -Parallel` runspaces.
Code ReviewThis code review is in beta and may not always be helpful — use your judgment. Suggestions (2)
ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
Member
Author
|
/rebase |
Replace both the macOS/Linux and Windows PowerShell examples with versions that take the project name as an argument, detect the production deployment via its Environment field, and delete preview deployments in parallel.
When no production deployment exists, the cleanup scripts now explain that one is required and point to deploying to the production branch (with an example wrangler command) instead of failing with a bare abort message.
- Aggregate failed deletions in the bash script and exit non-zero instead of always printing "Done." (the previous `|| echo` swallowed the child exit code, so xargs and the script always reported success). - Label the PowerShell tab "PowerShell 7+" since ForEach-Object -Parallel and -ThrottleLimit are not available in Windows PowerShell 5.1. - Drop the "Note that" filler phrase.
cloudflare-docs-bot
Bot
force-pushed
the
docs/pages-powershell-deployment-cleanup
branch
from
July 24, 2026 13:37
05006c4 to
6fcac6f
Compare
MattieTK
enabled auto-merge (squash)
July 24, 2026 16:55
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
Adds a Windows PowerShell version of the Pages deployment cleanup script alongside the existing macOS/Linux shell version (now in tabs), and improves both scripts to detect the production deployment by environment rather than by ID matching, run deletions in parallel, and print explicit guidance to create a production deployment first if none exists.
Continues the work from #31756 (opened by @AlexMnrs), moved here since I don't have push access to that branch's fork. Closes #31753.
Documentation checklist