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.

When
AutoCleanupis enabled (default), this action removes branch prereleases when a pull request closes. It now leaves stable releases and prereleases for other branches unchanged, including branches with empty, short, or differently cased sanitized names.After GitHub publishes a release with this fix, update the
usesreference forPSModule/Release-GHRepositoryto that release. Keep existing inputs and settings. This fix does not restore releases or tags that earlier runs removed.Fixed: Cleanup leaves unrelated releases unchanged
Cleanup selects a release only if GitHub marks it as a prerelease and its tag starts with the configured
VersionPrefix, a SemVer version, and the exact sanitized branch name as its first prerelease identifier. Matching is case-sensitive. If sanitization produces an empty identifier, cleanup selects no releases and logs a warning.Plain, incremental, and date-based prereleases for the same branch remain eligible after an unmerged close or merge. This change does not add or remove action inputs or settings.
Migration guide
usesreference forPSModule/Release-GHRepositoryto that release.Technical details
Publication evidence. GitHub's latest release record is v2.0.3, record
351975133, published2026-07-10T08:29:31Z. Its lightweight tag currently resolves to commit750abed0ecab02394554b610dc3aa191e75e3248, but the release record saysimmutable=false; this current pointer does not prove its original publication target.The successful Release workflow run has a retained check annotation,
Release created: v2.0.3, which links that release name to the run. The run is for PR #106 and reports head2eff1d0417281f9dd3da2fae69ae3f17c9eb8186; it does not report the release target commit. Its logs are no longer available (HTTP 410), and it has no retained artifacts. The release workflow's stable-release command does not specify--target. Therefore, the original tag-to-commit binding and publication-to-candidate source range are unverified. Do not treat v2.0.3 as a proven publication baseline.The fixed candidate is PSModule/Release-GHRepository@9f473cb39d3de649546c62abe497f531345583d5. The PR base is
750abed0ecab02394554b610dc3aa191e75e3248. The PR-base-to-candidate comparison contains three commits and only the three files listed below. This verifies the PR's diff scope, not the full publication-to-candidate range. PSModule/Release-GHRepository#109 is open and outside this candidate.Producer and completion. The candidate's
.github/workflows/Release.ymlcalls the local action on pull request events tomain. Its stable-release path creates GitHub releases when a pull request merges. The candidate keeps the existingAutoCleanup,AutoPatching, version-prefix, and label inputs unchanged. No consumer integration template applies; the README has a usage example, not a managed consumer template.This PR has no linked delivery issue or plan. The focused open-issue search found PSModule/Release-GHRepository#111, which covers the broader resolver and cleanup behavior, and PSModule/Release-GHRepository#112, which tracks release-decision enforcement; both remain open. This PR fixes branch-safe selection only and resolves neither issue. PSModule/Release-GHRepository#109 is open and does not provide the effective producer for this candidate.
Local validation against the fixed candidate: Pester 6.1.0, 22 passed, 0 failed; PSScriptAnalyzer, 0 diagnostics. GitHub and git operations are mocked.
src/main.ps1action.ymlinput contracttests/ReleaseCleanup.Tests.ps1src/main.ps1action entry pointREADME.mdaction.ymlinput contract.github/workflows/Release.yml,action.yml, and main rulesetRelated links
Release details
Status: Incomplete. The publication-to-candidate source range is unverified. The native producer also does not map
release:*labels or provide a required release-decision check.The active repository ruleset does not require status checks. Branch protection is absent. GitHub did not provide organization-level rulesets because this request requires the
admin:orgscope. No checks are currently reported for this branch. This description does not establish a valid Release Management decision or clear publication.