diff --git a/.github/linters/.codespellrc b/.github/linters/.codespellrc new file mode 100644 index 0000000..5f3e9d9 --- /dev/null +++ b/.github/linters/.codespellrc @@ -0,0 +1,2 @@ +[codespell] +skip = ./.github/linters diff --git a/.github/workflows/Linter.yml b/.github/workflows/Linter.yml index 3a07190..9ea2864 100644 --- a/.github/workflows/Linter.yml +++ b/.github/workflows/Linter.yml @@ -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 diff --git a/src/init.ps1 b/src/init.ps1 index aec82f3..a02a411 100644 --- a/src/init.ps1 +++ b/src/init.ps1 @@ -148,13 +148,13 @@ 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 = ( @@ -162,7 +162,7 @@ LogGroup 'Determine release configuration' { ).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 } @@ -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 @@ -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 } diff --git a/src/publish.ps1 b/src/publish.ps1 index 7e4afc3..7226c1f 100644 --- a/src/publish.ps1 +++ b/src/publish.ps1 @@ -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 @@ -56,6 +57,7 @@ LogGroup 'Load publish context from environment' { Write-Host '-------------------------------------------------' [PSCustomObject]@{ + ShouldPublish = $shouldPublish CreateRelease = $createRelease CreatePrerelease = $createPrerelease NewVersion = $newVersion.ToString()