Repository navigation
Stop preview cleanup from deleting other PRs' previews - #4626
Merged
Merged
Conversation
`aws s3 rm` matches by key prefix, so the cleanup for PR 461 also removed the previews for PRs 4610 to 4619. A trailing slash limits the delete to the closed PR's own folder. Co-Authored-By: Claude Sonnet 5.5 <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.
Closing a pull request no longer deletes the previews of other pull requests whose number starts with the same digits.
Affects: Deploys & previews
Prompt summary: Check that the shared preview cleanup on
mainworks, especially the S3 delete. The review found that the delete matches by key prefix, so the author asked for the one-character fix.Why
preview-cleanup.ymlrunsaws s3 rmon.../docs/${PR_NUMBER}with--recursive, and the CLI deletes every key that starts with that string. Closing PR 461 removes the previews of PRs 4610 to 4619 as well, and PR 4619 would also match a future PR 46190. The same applies to thepullfolder of the docs preview. The delete in the cleanup run for #4619 touched onlydocs/4619/, because no longer numbers exist yet.What
Preview cleanup delete
The S3 path now ends in a slash, so the delete only matches keys inside the closed PR's own folder. Previews upload to
<folder>/<number>/, so every object of that PR is still removed.Verify
Close a pull request that has a preview and open the
Delete s3 objectsstep of the cleanup run. Everydelete:line should sit under.../<folder>/<number>/.Out of scope: the fix is untested against a live bucket, because
pull_request_targetruns the base branch's workflow andmaindoes not carry it yet. The first PR closed after the merge shows it in the cleanup log.Risk: this workflow deletes objects in the shared preview bucket. A revert restores the old prefix match, but it does not restore objects already deleted.
🤖 Generated with Claude Code