From 85c8b514dda06e72fd197c0503fb54a7d79988bd Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 25 May 2026 01:14:24 +0200 Subject: [PATCH 1/3] Default to patch-level prerelease for all open PRs with important changes --- src/main.ps1 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main.ps1 b/src/main.ps1 index 83ad38a..0551efa 100644 --- a/src/main.ps1 +++ b/src/main.ps1 @@ -197,7 +197,6 @@ $settings = [pscustomobject]@{ MinorLabels = $settings.Publish.Module.MinorLabels ?? 'minor, feature' PatchLabels = $settings.Publish.Module.PatchLabels ?? 'patch, fix' IgnoreLabels = $settings.Publish.Module.IgnoreLabels ?? 'NoRelease' - PrereleaseLabels = $settings.Publish.Module.PrereleaseLabels ?? 'prerelease' UsePRTitleAsReleaseName = $settings.Publish.Module.UsePRTitleAsReleaseName ?? $false UsePRBodyAsReleaseNotes = $settings.Publish.Module.UsePRBodyAsReleaseNotes ?? $true UsePRTitleAsNotesHeading = $settings.Publish.Module.UsePRTitleAsNotesHeading ?? $true @@ -249,10 +248,6 @@ LogGroup 'Calculate Job Run Conditions:' { $isMergedPR = $isPR -and $pullRequestAction -eq 'closed' -and $pullRequestIsMerged -eq $true $isNotAbandonedPR = -not $isAbandonedPR - # Check if a prerelease label exists on the PR - $prereleaseLabels = $settings.Publish.Module.PrereleaseLabels -split ',' | ForEach-Object { $_.Trim() } - $prLabels = @($pullRequest.labels.name) - $hasPrereleaseLabel = ($prLabels | Where-Object { $prereleaseLabels -contains $_ }).Count -gt 0 $isOpenOrLabeledPR = $isPR -and $pullRequestAction -in @('opened', 'reopened', 'synchronize', 'labeled') # Check if important files have changed in the PR @@ -338,9 +333,10 @@ If you believe this is incorrect, please verify that your changes are in the cor Write-Host 'Not a PR event or missing PR number - treating as having important changes' } - # Prerelease requires both: prerelease label AND important file changes - # No point creating a prerelease if only non-module files changed - $shouldPrerelease = $isOpenOrLabeledPR -and $hasPrereleaseLabel -and $hasImportantChanges + # Prerelease happens automatically for any open PR with important file changes. + # Use AutoPatching (default: true) for patch-level bump; add major/minor labels for larger bumps. + # Add an IgnoreLabel (default: 'NoRelease') to opt out. + $shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges # Determine ReleaseType - what type of release to create # Values: 'Release', 'Prerelease', 'None' @@ -362,7 +358,6 @@ If you believe this is incorrect, please verify that your changes are in the cor isMergedPR = $isMergedPR isNotAbandonedPR = $isNotAbandonedPR isTargetDefaultBranch = $isTargetDefaultBranch - hasPrereleaseLabel = $hasPrereleaseLabel shouldPrerelease = $shouldPrerelease ReleaseType = $releaseType HasImportantChanges = $hasImportantChanges From b0a73728ac9a92133fe3368379a14d88ea068571 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 25 May 2026 01:16:24 +0200 Subject: [PATCH 2/3] Gate shouldPrerelease on AutoPatching or version bump label, block on ignore label --- src/main.ps1 | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main.ps1 b/src/main.ps1 index 0551efa..6ca0acc 100644 --- a/src/main.ps1 +++ b/src/main.ps1 @@ -333,10 +333,19 @@ If you believe this is incorrect, please verify that your changes are in the cor Write-Host 'Not a PR event or missing PR number - treating as having important changes' } - # Prerelease happens automatically for any open PR with important file changes. - # Use AutoPatching (default: true) for patch-level bump; add major/minor labels for larger bumps. - # Add an IgnoreLabel (default: 'NoRelease') to opt out. - $shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges + # Evaluate PR labels against configured label lists + $prLabels = @($pullRequest.Labels | ForEach-Object { $_.Name }) + $ignoreLabels = ($settings.Publish.Module.IgnoreLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } + $majorLabels = ($settings.Publish.Module.MajorLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } + $minorLabels = ($settings.Publish.Module.MinorLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } + $patchLabels = ($settings.Publish.Module.PatchLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } + + $hasIgnoreLabel = ($prLabels | Where-Object { $ignoreLabels -contains $_ }).Count -gt 0 + $hasVersionBumpLabel = ($prLabels | Where-Object { ($majorLabels + $minorLabels + $patchLabels) -contains $_ }).Count -gt 0 + $hasVersionBumpOrAutoPatch = $settings.Publish.Module.AutoPatching -or $hasVersionBumpLabel + + # Prerelease: open PR with important changes, not opted out, and either AutoPatching or an explicit version bump label. + $shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges -and $hasVersionBumpOrAutoPatch -and -not $hasIgnoreLabel # Determine ReleaseType - what type of release to create # Values: 'Release', 'Prerelease', 'None' @@ -351,16 +360,19 @@ If you believe this is incorrect, please verify that your changes are in the cor } [pscustomobject]@{ - isPR = $isPR - isOpenOrUpdatedPR = $isOpenOrUpdatedPR - isOpenOrLabeledPR = $isOpenOrLabeledPR - isAbandonedPR = $isAbandonedPR - isMergedPR = $isMergedPR - isNotAbandonedPR = $isNotAbandonedPR - isTargetDefaultBranch = $isTargetDefaultBranch - shouldPrerelease = $shouldPrerelease - ReleaseType = $releaseType - HasImportantChanges = $hasImportantChanges + isPR = $isPR + isOpenOrUpdatedPR = $isOpenOrUpdatedPR + isOpenOrLabeledPR = $isOpenOrLabeledPR + isAbandonedPR = $isAbandonedPR + isMergedPR = $isMergedPR + isNotAbandonedPR = $isNotAbandonedPR + isTargetDefaultBranch = $isTargetDefaultBranch + hasIgnoreLabel = $hasIgnoreLabel + hasVersionBumpLabel = $hasVersionBumpLabel + hasVersionBumpOrAutoPatch = $hasVersionBumpOrAutoPatch + shouldPrerelease = $shouldPrerelease + ReleaseType = $releaseType + HasImportantChanges = $hasImportantChanges } | Format-List | Out-String } From 41fe3ebf54342d84e9764491a9c3fd0295cbcd2e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 25 May 2026 01:35:05 +0200 Subject: [PATCH 3/3] Restore Prerelease label gate; add PrereleaseLabels config and ignore label early-exit --- src/main.ps1 | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/main.ps1 b/src/main.ps1 index 6ca0acc..dbe4868 100644 --- a/src/main.ps1 +++ b/src/main.ps1 @@ -196,6 +196,7 @@ $settings = [pscustomobject]@{ MajorLabels = $settings.Publish.Module.MajorLabels ?? 'major, breaking' MinorLabels = $settings.Publish.Module.MinorLabels ?? 'minor, feature' PatchLabels = $settings.Publish.Module.PatchLabels ?? 'patch, fix' + PrereleaseLabels = $settings.Publish.Module.PrereleaseLabels ?? 'Prerelease' IgnoreLabels = $settings.Publish.Module.IgnoreLabels ?? 'NoRelease' UsePRTitleAsReleaseName = $settings.Publish.Module.UsePRTitleAsReleaseName ?? $false UsePRBodyAsReleaseNotes = $settings.Publish.Module.UsePRBodyAsReleaseNotes ?? $true @@ -335,17 +336,15 @@ If you believe this is incorrect, please verify that your changes are in the cor # Evaluate PR labels against configured label lists $prLabels = @($pullRequest.Labels | ForEach-Object { $_.Name }) + $prereleaseLabels = ($settings.Publish.Module.PrereleaseLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } $ignoreLabels = ($settings.Publish.Module.IgnoreLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } - $majorLabels = ($settings.Publish.Module.MajorLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } - $minorLabels = ($settings.Publish.Module.MinorLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } - $patchLabels = ($settings.Publish.Module.PatchLabels -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ } + $hasPrereleaseLabel = ($prLabels | Where-Object { $prereleaseLabels -contains $_ }).Count -gt 0 $hasIgnoreLabel = ($prLabels | Where-Object { $ignoreLabels -contains $_ }).Count -gt 0 - $hasVersionBumpLabel = ($prLabels | Where-Object { ($majorLabels + $minorLabels + $patchLabels) -contains $_ }).Count -gt 0 - $hasVersionBumpOrAutoPatch = $settings.Publish.Module.AutoPatching -or $hasVersionBumpLabel - # Prerelease: open PR with important changes, not opted out, and either AutoPatching or an explicit version bump label. - $shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges -and $hasVersionBumpOrAutoPatch -and -not $hasIgnoreLabel + # Prerelease: open PR with the Prerelease label, important changes, and not opted out via ignore label. + # Version level (patch/minor/major) is determined by Resolve-PSModuleVersion based on version bump labels and AutoPatching. + $shouldPrerelease = $isOpenOrLabeledPR -and $hasPrereleaseLabel -and $hasImportantChanges -and -not $hasIgnoreLabel # Determine ReleaseType - what type of release to create # Values: 'Release', 'Prerelease', 'None' @@ -360,19 +359,18 @@ If you believe this is incorrect, please verify that your changes are in the cor } [pscustomobject]@{ - isPR = $isPR - isOpenOrUpdatedPR = $isOpenOrUpdatedPR - isOpenOrLabeledPR = $isOpenOrLabeledPR - isAbandonedPR = $isAbandonedPR - isMergedPR = $isMergedPR - isNotAbandonedPR = $isNotAbandonedPR - isTargetDefaultBranch = $isTargetDefaultBranch - hasIgnoreLabel = $hasIgnoreLabel - hasVersionBumpLabel = $hasVersionBumpLabel - hasVersionBumpOrAutoPatch = $hasVersionBumpOrAutoPatch - shouldPrerelease = $shouldPrerelease - ReleaseType = $releaseType - HasImportantChanges = $hasImportantChanges + isPR = $isPR + isOpenOrUpdatedPR = $isOpenOrUpdatedPR + isOpenOrLabeledPR = $isOpenOrLabeledPR + isAbandonedPR = $isAbandonedPR + isMergedPR = $isMergedPR + isNotAbandonedPR = $isNotAbandonedPR + isTargetDefaultBranch = $isTargetDefaultBranch + hasPrereleaseLabel = $hasPrereleaseLabel + hasIgnoreLabel = $hasIgnoreLabel + shouldPrerelease = $shouldPrerelease + ReleaseType = $releaseType + HasImportantChanges = $hasImportantChanges } | Format-List | Out-String } @@ -568,7 +566,7 @@ LogGroup 'Calculate Job Run Conditions:' { # Check if setup/teardown scripts exist in the repository $hasBeforeAllScript = Test-Path -Path 'tests/BeforeAll.ps1' $hasAfterAllScript = Test-Path -Path 'tests/AfterAll.ps1' - Write-Host "Setup/teardown script detection:" + Write-Host 'Setup/teardown script detection:' Write-Host " tests/BeforeAll.ps1 exists: $hasBeforeAllScript" Write-Host " tests/AfterAll.ps1 exists: $hasAfterAllScript"