Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/linters/.codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
skip = ./.github/linters
2 changes: 1 addition & 1 deletion .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
persist-credentials: false

- name: Lint code base
uses: super-linter/super-linter@d5b0a2ab116623730dd094f15ddc1b6b25bf7b99 # v8.3.2
uses: super-linter/super-linter@12562e48d7059cf666c43a4ecb0d3b5a2b31bd9e # v8.4.0
env:
GITHUB_TOKEN: ${{ github.token }}
VALIDATE_BIOME_FORMAT: false
Expand Down
14 changes: 7 additions & 7 deletions src/init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,21 @@ LogGroup 'Determine release configuration' {
$shouldPublish = $false
}

# Determine version bump type from labels (only when publishing)
# Determine version bump type from labels (when publishing or in WhatIf mode to show what would happen)
$majorRelease = $false
$minorRelease = $false
$patchRelease = $false
$hasVersionBump = $false

if ($shouldPublish) {
if ($shouldPublish -or $whatIf) {
$majorRelease = ($labels | Where-Object { $majorLabels -contains $_ }).Count -gt 0
$minorRelease = ($labels | Where-Object { $minorLabels -contains $_ }).Count -gt 0 -and -not $majorRelease
$patchRelease = (
($labels | Where-Object { $patchLabels -contains $_ }
).Count -gt 0 -or $autoPatching) -and -not $majorRelease -and -not $minorRelease

$hasVersionBump = $majorRelease -or $minorRelease -or $patchRelease
if (-not $hasVersionBump) {
if (-not $hasVersionBump -and $shouldPublish) {
Write-Host 'No version bump label found and AutoPatching is disabled. Skipping publish.'
$shouldPublish = $false
}
Expand Down Expand Up @@ -190,8 +190,8 @@ $newVersion = $null
$releases = @()
$prereleaseTagsToCleanup = ''

# Fetch releases if publishing OR if cleanup is enabled (cleanup can work independently)
if ($shouldPublish -or $autoCleanup) {
# Fetch releases if publishing OR if cleanup is enabled OR WhatIf mode (to show what would happen)
if ($shouldPublish -or $autoCleanup -or $whatIf) {
#region Get releases
LogGroup 'Get all releases - GitHub' {
$releases = gh release list --json 'createdAt,isDraft,isLatest,isPrerelease,name,publishedAt,tagName' | ConvertFrom-Json
Expand All @@ -206,8 +206,8 @@ if ($shouldPublish -or $autoCleanup) {
#endregion Get releases
}

# Version calculation is only needed when publishing
if ($shouldPublish) {
# Version calculation is needed when publishing OR in WhatIf mode (to show what would be created)
if ($shouldPublish -or $whatIf) {
#region Get versions
LogGroup 'Get latest version - GitHub' {
$latestRelease = $releases | Where-Object { $_.isLatest -eq $true }
Expand Down
2 changes: 2 additions & 0 deletions src/publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ LogGroup 'Load inputs' {
}

LogGroup 'Load publish context from environment' {
$shouldPublish = $env:PUBLISH_CONTEXT_ShouldPublish -eq 'true'
$createRelease = $env:PUBLISH_CONTEXT_CreateRelease -eq 'true'
$createPrerelease = $env:PUBLISH_CONTEXT_CreatePrerelease -eq 'true'
$newVersionString = $env:PUBLISH_CONTEXT_NewVersion
Expand All @@ -56,6 +57,7 @@ LogGroup 'Load publish context from environment' {

Write-Host '-------------------------------------------------'
[PSCustomObject]@{
ShouldPublish = $shouldPublish
CreateRelease = $createRelease
CreatePrerelease = $createPrerelease
NewVersion = $newVersion.ToString()
Expand Down
Loading