@@ -333,10 +333,19 @@ If you believe this is incorrect, please verify that your changes are in the cor
333333 Write-Host ' Not a PR event or missing PR number - treating as having important changes'
334334 }
335335
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
336+ # Evaluate PR labels against configured label lists
337+ $prLabels = @ ($pullRequest.Labels | ForEach-Object { $_.Name })
338+ $ignoreLabels = ($settings.Publish.Module.IgnoreLabels -split ' ,' ) | ForEach-Object { $_.Trim () } | Where-Object { $_ }
339+ $majorLabels = ($settings.Publish.Module.MajorLabels -split ' ,' ) | ForEach-Object { $_.Trim () } | Where-Object { $_ }
340+ $minorLabels = ($settings.Publish.Module.MinorLabels -split ' ,' ) | ForEach-Object { $_.Trim () } | Where-Object { $_ }
341+ $patchLabels = ($settings.Publish.Module.PatchLabels -split ' ,' ) | ForEach-Object { $_.Trim () } | Where-Object { $_ }
342+
343+ $hasIgnoreLabel = ($prLabels | Where-Object { $ignoreLabels -contains $_ }).Count -gt 0
344+ $hasVersionBumpLabel = ($prLabels | Where-Object { ($majorLabels + $minorLabels + $patchLabels ) -contains $_ }).Count -gt 0
345+ $hasVersionBumpOrAutoPatch = $settings.Publish.Module.AutoPatching -or $hasVersionBumpLabel
346+
347+ # Prerelease: open PR with important changes, not opted out, and either AutoPatching or an explicit version bump label.
348+ $shouldPrerelease = $isOpenOrLabeledPR -and $hasImportantChanges -and $hasVersionBumpOrAutoPatch -and -not $hasIgnoreLabel
340349
341350 # Determine ReleaseType - what type of release to create
342351 # Values: 'Release', 'Prerelease', 'None'
@@ -351,16 +360,19 @@ If you believe this is incorrect, please verify that your changes are in the cor
351360 }
352361
353362 [pscustomobject ]@ {
354- isPR = $isPR
355- isOpenOrUpdatedPR = $isOpenOrUpdatedPR
356- isOpenOrLabeledPR = $isOpenOrLabeledPR
357- isAbandonedPR = $isAbandonedPR
358- isMergedPR = $isMergedPR
359- isNotAbandonedPR = $isNotAbandonedPR
360- isTargetDefaultBranch = $isTargetDefaultBranch
361- shouldPrerelease = $shouldPrerelease
362- ReleaseType = $releaseType
363- HasImportantChanges = $hasImportantChanges
363+ isPR = $isPR
364+ isOpenOrUpdatedPR = $isOpenOrUpdatedPR
365+ isOpenOrLabeledPR = $isOpenOrLabeledPR
366+ isAbandonedPR = $isAbandonedPR
367+ isMergedPR = $isMergedPR
368+ isNotAbandonedPR = $isNotAbandonedPR
369+ isTargetDefaultBranch = $isTargetDefaultBranch
370+ hasIgnoreLabel = $hasIgnoreLabel
371+ hasVersionBumpLabel = $hasVersionBumpLabel
372+ hasVersionBumpOrAutoPatch = $hasVersionBumpOrAutoPatch
373+ shouldPrerelease = $shouldPrerelease
374+ ReleaseType = $releaseType
375+ HasImportantChanges = $hasImportantChanges
364376 } | Format-List | Out-String
365377}
366378
0 commit comments