Repository navigation
Release cleanup preserves stable and unrelated releases - #113
Open
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Open
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
Conversation
Marius Storhaug (MariusStorhaug)
marked this pull request as ready for review
November 2, 2026 23:29
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The case-insensitive release matcher can delete a release and tag belonging to a distinct, differently cased branch, requiring case-sensitive matching and a regression fixture.
1 open issue
What changed in this PR
This PR narrows branch prerelease cleanup to protect stable releases and unrelated releases when pull requests close.
Changes:
- Skip cleanup with a warning when the sanitized branch name is empty.
- Require prerelease status and an anchored tag pattern using the configured prefix and sanitized branch identifier.
- Add mocked regression tests and document cleanup behavior and the local test command.
| File | Description |
|---|---|
tests/ReleaseCleanup.Tests.ps1 |
Adds regression coverage for branch matching, cleanup controls, prefixes, and WhatIf previews. |
src/main.ps1 |
Replaces substring selection with guarded prerelease filtering. |
README.md |
Documents cleanup safeguards and how to run local tests. |
Review effort: Balanced
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.

Release cleanup now fails closed for empty sanitized branch names and only selects prereleases belonging to the intended branch. Stable releases and unrelated releases are no longer selected when a pull request closes, including branches such as
_,-,v1,1, or0.Fixed: Cleanup only removes matching branch prereleases
Cleanup requires
isPrereleaseto be true and an anchored version tag matching the configuredVersionPrefixand the exact sanitized branch name as its first prerelease identifier. When sanitization leaves an empty identifier, cleanup selects nothing and reports a warning.Plain, incremental, and date-based branch prereleases still clean up after an unmerged close or a merge.
AutoCleanup, WhatIf previews, custom prefixes, and prefix-free tags retain their supported behavior. No input or configuration changes are required to use this fix. This change does not recover releases or tags deleted by earlier runs.Technical details
src/main.ps1, addedtests/ReleaseCleanup.Tests.ps1, and documented cleanup behavior and the local test command inREADME.md.git diff --checkpassed.ea0c3b1523f4483234db760cc30f72781b04cc08. This draft describes the scoped implementation againstmain, not a bundled publication-to-candidate release inventory.src/main.ps1tests/ReleaseCleanup.Tests.ps1README.md