-
Notifications
You must be signed in to change notification settings - Fork 0
🌟 [Major]: Rename AutoCleanup to CleanupPrereleases and separate cleanup from release type
#8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ptions in schema and related scripts
AutoCleanup to CleanupPrereleases and separate cleanup from release type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the prerelease cleanup mechanism by renaming AutoCleanup to CleanupPrereleases and separating the cleanup decision from the ReleaseType enum. The cleanup logic is now computed independently based on the PR state and user preferences, making the behavior more explicit and easier to understand.
Changes:
- Renamed
Publish.Module.AutoCleanuptoPublish.Module.CleanupPrereleasesfor clarity - Removed
Cleanupfrom theReleaseTypeenum (now onlyRelease,Prerelease, orNone) - Moved
ReleaseTypeand the computedCleanupPrereleasesvalue toPublish.Modulesection instead ofRun
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/scenarios/valid/PSModule.yml | Updated test configuration to use new Publish.Module.CleanupPrereleases structure |
| tests/scenarios/invalid-percent-target/PSModule.yml | Updated test configuration to use new Publish.Module.CleanupPrereleases structure |
| scripts/main.ps1 | Implemented the core refactoring: renamed setting, separated cleanup logic from ReleaseType, and added computed values to Publish.Module |
| scripts/Settings.schema.json | Updated schema to rename AutoCleanup to CleanupPrereleases, improved description, and removed 'Cleanup' from ReleaseType enum |
Comments suppressed due to low confidence (1)
scripts/Settings.schema.json:181
- The schema is missing the
ReleaseTypeproperty definition in thePublish.Modulesection. According to the PR description and the code changes inscripts/main.ps1(line 433),ReleaseTypeis now being added as a computed property toPublish.Module. The schema should include aReleaseTypeproperty here with the same structure as defined in theRunsection (type: string, enum: ["Release", "Prerelease", "None"]).
"properties": {
"Skip": {
"type": "boolean",
"description": "Skip module publish"
},
"CleanupPrereleases": {
"type": "boolean",
"description": "When enabled (default: true), automatically cleans up old prerelease tags when merging to main or when a PR is abandoned"
},
"AutoPatching": {
"type": "boolean",
"description": "Automatically apply patches"
},
"IncrementalPrerelease": {
"type": "boolean",
"description": "Use incremental prerelease versioning"
},
"DatePrereleaseFormat": {
"type": "string",
"description": "Date format for prerelease versions"
},
"VersionPrefix": {
"type": "string",
"description": "Prefix for version tags"
},
"MajorLabels": {
"type": "string",
"description": "Comma-separated labels that trigger major version bump"
},
"MinorLabels": {
"type": "string",
"description": "Comma-separated labels that trigger minor version bump"
},
"PatchLabels": {
"type": "string",
"description": "Comma-separated labels that trigger patch version bump"
},
"IgnoreLabels": {
"type": "string",
"description": "Comma-separated labels that prevent release"
},
"PrereleaseLabels": {
"type": "string",
"description": "Comma-separated labels that trigger a prerelease"
},
"UsePRTitleAsReleaseName": {
"type": "boolean",
"description": "Use pull request title as the GitHub release name"
},
"UsePRBodyAsReleaseNotes": {
"type": "boolean",
"description": "Use pull request body as the release notes content"
},
"UsePRTitleAsNotesHeading": {
"type": "boolean",
"description": "Add pull request title as H1 heading in release notes"
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…licate definition
…d logic in settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.AutoCleanup -eq $true) | ||
|
|
||
| # Update Publish.Module with computed release values | ||
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | ||
| $settings.Publish.Module.AutoCleanup = $shouldAutoCleanup |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is reading from $settings.Publish.Module.AutoCleanup but this setting has been renamed to CleanupPrereleases in the schema and test files. This needs to be updated to $settings.Publish.Module.CleanupPrereleases to match the new property name. This is a critical bug as it will cause the setting to not be read correctly from configuration files.
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.AutoCleanup -eq $true) | |
| # Update Publish.Module with computed release values | |
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | |
| $settings.Publish.Module.AutoCleanup = $shouldAutoCleanup | |
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.CleanupPrereleases -eq $true) | |
| # Update Publish.Module with computed release values | |
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | |
| $settings.Publish.Module.CleanupPrereleases = $shouldAutoCleanup |
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.AutoCleanup -eq $true) | ||
|
|
||
| # Update Publish.Module with computed release values | ||
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | ||
| $settings.Publish.Module.AutoCleanup = $shouldAutoCleanup |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is assigning to $settings.Publish.Module.AutoCleanup but this property has been renamed to CleanupPrereleases. This needs to be updated to $settings.Publish.Module.CleanupPrereleases to match the new property name and ensure consumers of the settings output can access it correctly. This is a critical bug as workflows will expect the new property name based on the schema.
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.AutoCleanup -eq $true) | |
| # Update Publish.Module with computed release values | |
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | |
| $settings.Publish.Module.AutoCleanup = $shouldAutoCleanup | |
| $shouldAutoCleanup = (($releaseType -eq 'Release') -or $isAbandonedPR) -and ($settings.Publish.Module.CleanupPrereleases -eq $true) | |
| # Update Publish.Module with computed release values | |
| $settings.Publish.Module | Add-Member -MemberType NoteProperty -Name ReleaseType -Value $releaseType -Force | |
| $settings.Publish.Module.CleanupPrereleases = $shouldAutoCleanup |
| } elseif ($isMergedPR -and $isTargetDefaultBranch) { | ||
| # Determine ReleaseType - what type of release to create | ||
| # Values: 'Release', 'Prerelease', 'None' | ||
| # Note: Cleanup is a separate decision handled by AutoCleanup |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment references "AutoCleanup" but this setting has been renamed to "CleanupPrereleases". The comment should be updated to match the new naming convention.
| # Note: Cleanup is a separate decision handled by AutoCleanup | |
| # Note: Cleanup is a separate decision handled by CleanupPrereleases |
| # Calculate job-specific conditions and add to settings | ||
| LogGroup 'Calculate Job Run Conditions:' { | ||
| # Calculate if prereleases should be cleaned up: | ||
| # True if (Release or Abandoned PR) AND user has AutoCleanup enabled (defaults to true) |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment references "AutoCleanup" but this setting has been renamed to "CleanupPrereleases". The comment should be updated to match the new naming convention.
| # True if (Release or Abandoned PR) AND user has AutoCleanup enabled (defaults to true) | |
| # True if (Release or Abandoned PR) AND user has CleanupPrereleases enabled (defaults to true) |
The prerelease cleanup setting is now clearer and more intuitive. The
AutoCleanupsetting has been renamed toCleanupPrereleases, and the cleanup decision is now independent from the release type. BothReleaseTypeand the computedCleanupPrereleasesvalue are now stored in thePublish.Modulesection of the settings output.Renamed setting from AutoCleanup to CleanupPrereleases
The
Publish.Module.AutoCleanupsetting has been renamed toPublish.Module.CleanupPrereleasesfor clarity. The setting still defaults totrue.Before:
After:
Cleanup is now independent from ReleaseType
Previously,
ReleaseTypecould be set toCleanupto trigger prerelease cleanup. Now,ReleaseTypeonly has three values:Release,Prerelease, orNone. The cleanup decision is computed separately based on:CleanupPrereleasesis enabled in your settings (defaults totrue)ReleaseType and CleanupPrereleases moved to Publish.Module
Both computed values are now stored in
Publish.Modulerather than theRunobject:Publish.Module.ReleaseType- The calculated release type (Release,Prerelease, orNone)Publish.Module.CleanupPrereleases- The computed cleanup decision (boolean)This change organizes release-related computed values alongside other publish settings. Workflows should now reference
fromJson(inputs.Settings).Publish.Module.ReleaseTypeandfromJson(inputs.Settings).Publish.Module.CleanupPrereleases.