Skip to content

Commit 85c8b51

Browse files
Default to patch-level prerelease for all open PRs with important changes
1 parent 6a84830 commit 85c8b51

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/main.ps1

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ $settings = [pscustomobject]@{
197197
MinorLabels = $settings.Publish.Module.MinorLabels ?? 'minor, feature'
198198
PatchLabels = $settings.Publish.Module.PatchLabels ?? 'patch, fix'
199199
IgnoreLabels = $settings.Publish.Module.IgnoreLabels ?? 'NoRelease'
200-
PrereleaseLabels = $settings.Publish.Module.PrereleaseLabels ?? 'prerelease'
201200
UsePRTitleAsReleaseName = $settings.Publish.Module.UsePRTitleAsReleaseName ?? $false
202201
UsePRBodyAsReleaseNotes = $settings.Publish.Module.UsePRBodyAsReleaseNotes ?? $true
203202
UsePRTitleAsNotesHeading = $settings.Publish.Module.UsePRTitleAsNotesHeading ?? $true
@@ -249,10 +248,6 @@ LogGroup 'Calculate Job Run Conditions:' {
249248
$isMergedPR = $isPR -and $pullRequestAction -eq 'closed' -and $pullRequestIsMerged -eq $true
250249
$isNotAbandonedPR = -not $isAbandonedPR
251250

252-
# Check if a prerelease label exists on the PR
253-
$prereleaseLabels = $settings.Publish.Module.PrereleaseLabels -split ',' | ForEach-Object { $_.Trim() }
254-
$prLabels = @($pullRequest.labels.name)
255-
$hasPrereleaseLabel = ($prLabels | Where-Object { $prereleaseLabels -contains $_ }).Count -gt 0
256251
$isOpenOrLabeledPR = $isPR -and $pullRequestAction -in @('opened', 'reopened', 'synchronize', 'labeled')
257252

258253
# 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
338333
Write-Host 'Not a PR event or missing PR number - treating as having important changes'
339334
}
340335

341-
# Prerelease requires both: prerelease label AND important file changes
342-
# No point creating a prerelease if only non-module files changed
343-
$shouldPrerelease = $isOpenOrLabeledPR -and $hasPrereleaseLabel -and $hasImportantChanges
336+
# Prerelease happens automatically for any open PR with important file changes.
337+
# Use AutoPatching (default: true) for patch-level bump; add major/minor labels for larger bumps.
338+
# Add an IgnoreLabel (default: 'NoRelease') to opt out.
339+
$shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges
344340

345341
# Determine ReleaseType - what type of release to create
346342
# Values: 'Release', 'Prerelease', 'None'
@@ -362,7 +358,6 @@ If you believe this is incorrect, please verify that your changes are in the cor
362358
isMergedPR = $isMergedPR
363359
isNotAbandonedPR = $isNotAbandonedPR
364360
isTargetDefaultBranch = $isTargetDefaultBranch
365-
hasPrereleaseLabel = $hasPrereleaseLabel
366361
shouldPrerelease = $shouldPrerelease
367362
ReleaseType = $releaseType
368363
HasImportantChanges = $hasImportantChanges

0 commit comments

Comments
 (0)