Skip to content

Conversation

@MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Jan 18, 2026

The prerelease cleanup setting is now clearer and more intuitive. The AutoCleanup setting has been renamed to CleanupPrereleases, and the cleanup decision is now independent from the release type. Both ReleaseType and the computed CleanupPrereleases value are now stored in the Publish.Module section of the settings output.

Renamed setting from AutoCleanup to CleanupPrereleases

The Publish.Module.AutoCleanup setting has been renamed to Publish.Module.CleanupPrereleases for clarity. The setting still defaults to true.

Before:

Publish:
  Module:
    AutoCleanup: true

After:

Publish:
  Module:
    CleanupPrereleases: true

Cleanup is now independent from ReleaseType

Previously, ReleaseType could be set to Cleanup to trigger prerelease cleanup. Now, ReleaseType only has three values: Release, Prerelease, or None. The cleanup decision is computed separately based on:

  1. Whether you're in a cleanup scenario (merging to main or abandoning a PR)
  2. Whether CleanupPrereleases is enabled in your settings (defaults to true)

ReleaseType and CleanupPrereleases moved to Publish.Module

Both computed values are now stored in Publish.Module rather than the Run object:

  • Publish.Module.ReleaseType - The calculated release type (Release, Prerelease, or None)
  • 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.ReleaseType and fromJson(inputs.Settings).Publish.Module.CleanupPrereleases.

@MariusStorhaug MariusStorhaug changed the title 🚀 [Feature]: Rename AutoCleanup to CleanupPrereleases and separate cleanup from release type 🌟 [Feature]: Rename AutoCleanup to CleanupPrereleases and separate cleanup from release type Jan 18, 2026
@MariusStorhaug MariusStorhaug changed the title 🌟 [Feature]: Rename AutoCleanup to CleanupPrereleases and separate cleanup from release type 🌟 [Major]: Rename AutoCleanup to CleanupPrereleases and separate cleanup from release type Jan 18, 2026
@MariusStorhaug MariusStorhaug marked this pull request as ready for review January 18, 2026 10:12
Copilot AI review requested due to automatic review settings January 18, 2026 10:12
Copy link
Contributor

Copilot AI left a 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.AutoCleanup to Publish.Module.CleanupPrereleases for clarity
  • Removed Cleanup from the ReleaseType enum (now only Release, Prerelease, or None)
  • Moved ReleaseType and the computed CleanupPrereleases value to Publish.Module section instead of Run

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 ReleaseType property definition in the Publish.Module section. According to the PR description and the code changes in scripts/main.ps1 (line 433), ReleaseType is now being added as a computed property to Publish.Module. The schema should include a ReleaseType property here with the same structure as defined in the Run section (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.

Copilot AI review requested due to automatic review settings January 18, 2026 12:41
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +430 to +434
$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
Copy link

Copilot AI Jan 18, 2026

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.

Suggested change
$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

Copilot uses AI. Check for mistakes.
Comment on lines +430 to +434
$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
Copy link

Copilot AI Jan 18, 2026

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.

Suggested change
$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

Copilot uses AI. Check for mistakes.
} 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
Copy link

Copilot AI Jan 18, 2026

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.

Suggested change
# Note: Cleanup is a separate decision handled by AutoCleanup
# Note: Cleanup is a separate decision handled by CleanupPrereleases

Copilot uses AI. Check for mistakes.
# 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)
Copy link

Copilot AI Jan 18, 2026

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.

Suggested change
# 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)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants