From 905ced93d13306c18ddf239d8bc2a02b4b48533a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 13 Nov 2026 20:16:10 +0100 Subject: [PATCH 1/8] Use the canonical release settings filename --- README.md | 16 ++- action.yml | 2 +- src/main.ps1 | 23 +++- tests/Release-GHRepository.Tests.ps1 | 155 +++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1518ef2..f14770c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The `pull_request_target` workflow checks out the trusted base branch. Do not ch | --- | --- | --- | --- | | `AutoCleanup` | Delete prereleases after the pull request closes. | `true` | false | | `CallerOverrides` | Supply a YAML or JSON mapping of explicit invocation overrides. These override repository settings. | `{}` | false | -| `ConfigurationFile` | Read repository settings from this file. File values override scalar action inputs, but not `CallerOverrides`. | `.github\auto-release.yml` | false | +| `ConfigurationFile` | Read repository settings from this file. File values override scalar action inputs, but not `CallerOverrides`. | `.github\release.settings.yml` | false | | `DefaultBump` | Select the bump when no explicit bump or skip label exists. Accepts exactly `patch`, `minor`, or `major` with case-sensitive matching. | `patch` | false | | `CreateMajorTag` | Create or update the floating major tag after a stable release. | `true` | false | | `CreateMinorTag` | Create or update the floating minor tag after a stable release. | `true` | false | @@ -106,9 +106,11 @@ The `pull_request_target` workflow checks out the trusted base branch. Do not ch Use the `release:prerelease` label to select repository prerelease behavior. The similarly named `Prerelease` action input only controls dependency resolution for the GitHub module used internally. -### Configuration file +### Settings file -The default configuration file is `.github\auto-release.yml`. Change its path with `ConfigurationFile`. +The optional repository settings file is `.github\release.settings.yml`. When it is absent, valid action defaults and caller inputs still apply. `ConfigurationFile` preserves explicit control over a custom settings path; it does not add another conventional filename or search path. + +The removed conventional `.github\auto-release.yml` path has no reader fallback or alias, even when selected explicitly. Its presence alongside the default settings path fails before GitHub operations instead of silently changing the release policy. An existing explicitly selected custom file is read as directed; a missing selected file cannot silently discard legacy conventional settings. The release record contains the exact filename/reader adoption steps. Settings resolve in this order: defaults declared in `action.yml`, scalar action inputs, repository settings, then explicit `CallerOverrides`. Scalar inputs retain the existing file-over-input behavior because GitHub injects their defaults even when callers omit them. Use `CallerOverrides` for an invocation-specific override; its omitted `{}` mapping inherits repository settings without masking them. @@ -117,12 +119,20 @@ An explicit `false` or empty string is an override, not an omitted setting. Bool The file and `CallerOverrides` must contain mappings. They accept the release settings from `AutoCleanup` through `WhatIf` in the input table, excluding `CallerOverrides` and `ConfigurationFile` themselves. The dependency/runtime inputs (`Debug`, `Verbose`, `Version`, `Prerelease`, and `WorkingDirectory`) are supplied separately by the caller. Unknown keys, removed keys, null values, and invalid values fail before label provisioning. ```yaml +# .github\release.settings.yml DatePrereleaseFormat: 'yyyyMMddHHmm' DefaultBump: patch IncrementalPrerelease: false VersionPrefix: '' ``` +For an intentional custom path: + +```yaml +with: + ConfigurationFile: .github\custom-release.settings.yml +``` + For an invocation-specific minor bump, even when the repository configures major: ```yaml diff --git a/action.yml b/action.yml index 4354c9d..78bfa79 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,7 @@ inputs: The repository settings file. File values override scalar action inputs; explicit CallerOverrides take precedence over file values. required: false - default: .github\auto-release.yml + default: .github\release.settings.yml DefaultBump: description: The release bump to use when no explicit release bump or skip label exists. Accepts exactly patch, minor, or major with case-sensitive matching. required: false diff --git a/src/main.ps1 b/src/main.ps1 index c2e5cb9..aebd1c7 100644 --- a/src/main.ps1 +++ b/src/main.ps1 @@ -69,8 +69,29 @@ LogGroup 'Set configuration' { if ([string]::IsNullOrWhiteSpace($configurationPath)) { throw 'ConfigurationFile must be a nonempty path.' } + $pathResolver = $ExecutionContext.SessionState.Path + $defaultConfigurationPath = $pathResolver.GetUnresolvedProviderPathFromPSPath( + $actionDefinition.inputs.ConfigurationFile.default + ) + $configurationPath = $pathResolver.GetUnresolvedProviderPathFromPSPath($configurationPath) + $legacyConfigurationPath = Join-Path -Path (Split-Path -Path $defaultConfigurationPath -Parent) -ChildPath 'auto-release.yml' + $pathComparison = [StringComparison]::Ordinal + if ($IsWindows) { + $pathComparison = [StringComparison]::OrdinalIgnoreCase + } + $usesDefaultPath = [string]::Equals($configurationPath, $defaultConfigurationPath, $pathComparison) + $usesLegacyPath = [string]::Equals($configurationPath, $legacyConfigurationPath, $pathComparison) + $configurationExists = Test-Path -LiteralPath $configurationPath -PathType Leaf + $legacyExists = Test-Path -LiteralPath $legacyConfigurationPath -PathType Leaf + if ($usesLegacyPath -or ($legacyExists -and ($usesDefaultPath -or -not $configurationExists))) { + throw ( + "Conventional settings [$legacyConfigurationPath] are no longer supported. " + + "Rename or reconcile the file into [$defaultConfigurationPath] and update ConfigurationFile " + + 'together with a compatible release-engine reference, or select an existing custom settings file.' + ) + } $configuration = @{} - if (-not (Test-Path -LiteralPath $configurationPath -PathType Leaf)) { + if (-not $configurationExists) { Write-Output "Configuration file not found at [$configurationPath]" } else { Write-Output "Reading from configuration file [$configurationPath]" diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index 8572fff..ef9b5bf 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -10,6 +10,8 @@ $ErrorActionPreference = 'Stop' BeforeAll { Import-Module -Name GitHub, powershell-yaml, PSSemVer $mainPath = Join-Path -Path $PSScriptRoot -ChildPath '..\src\main.ps1' + $actionPath = Join-Path -Path $PSScriptRoot -ChildPath '..\action.yml' + $actionDefinition = ConvertFrom-Yaml -Yaml (Get-Content -LiteralPath $actionPath -Raw) $headSha = '0123456789012345678901234567890123456789' $authoredBody = @' This release preserves the source-bound adoption record. @@ -78,6 +80,10 @@ Describe 'Release-GHRepository caller compatibility' { } $githubEvent | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $env:GITHUB_EVENT_PATH + $callerDirectory = Join-Path -Path $TestDrive -ChildPath ([guid]::NewGuid().ToString('N')) + $null = New-Item -Path (Join-Path -Path $callerDirectory -ChildPath '.github') -ItemType Directory + Push-Location -LiteralPath $callerDirectory + $releaseRecordsJson = '[{"tagName":"v2.0.3","isLatest":true,"isPrerelease":false}]' Mock Install-PSResource {} Mock Write-GitHubNotice {} @@ -95,6 +101,7 @@ Describe 'Release-GHRepository caller compatibility' { } AfterEach { + Pop-Location foreach ($name in $environmentNames) { if ($null -eq $savedEnvironment[$name]) { if (Test-Path -LiteralPath "Env:\$name") { @@ -106,6 +113,154 @@ Describe 'Release-GHRepository caller compatibility' { } } + It 'declares release.settings.yml as the only conventional settings default' { + $actionDefinition.inputs.ConfigurationFile.default | Should -BeExactly '.github\release.settings.yml' + $actionDefinition.runs.steps[0].env.PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile | + Should -BeExactly '${{ inputs.ConfigurationFile }}' + } + + It 'reads the declared default without an injected ConfigurationFile input' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + @' +DefaultBump: minor +WhatIf: true +'@ | Set-Content -LiteralPath '.github\release.settings.yml' + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Reading from configuration file .*release\.settings\.yml' + $output | Should -Match 'Default bump:\s+\[minor\]' + $output | Should -Match 'Default bump source:\s+\[RepositorySetting\]' + $output | Should -Match 'gh release create v2\.1\.0 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'inherits valid defaults when the conventional settings file is intentionally absent' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Configuration file not found at .*release\.settings\.yml' + $output | Should -Match 'Default bump:\s+\[patch\]' + $output | Should -Match 'Default bump source:\s+\[SharedDefault\]' + $output | Should -Match 'gh release create v2\.0\.4 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'rejects legacy-only conventional settings instead of silently applying another policy' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + @' +DefaultBump: major +WhatIf: false +'@ | Set-Content -LiteralPath '.github\auto-release.yml' + + { & $mainPath } | + Should -Throw '*auto-release.yml*no longer supported*release.settings.yml*ConfigurationFile*' + Should -Invoke gh -Times 0 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'rejects a legacy conventional file even when the new default file also exists' { + $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile = '.github\release.settings.yml' + 'DefaultBump: major' | Set-Content -LiteralPath '.github\auto-release.yml' + 'DefaultBump: minor' | Set-Content -LiteralPath '.github\release.settings.yml' + + { & $mainPath } | Should -Throw '*auto-release.yml*no longer supported*release.settings.yml*' + Should -Invoke gh -Times 0 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'rejects the removed conventional path even when explicitly supplied as ' -ForEach @( + @{ PathKind = 'relative'; PathValue = '.github\auto-release.yml' } + @{ PathKind = 'normalized relative'; PathValue = '.github\..\.github\auto-release.yml' } + @{ PathKind = 'absolute'; PathValue = $null } + ) { + $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile = $PathValue + if ($PathKind -eq 'absolute') { + $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile = Join-Path -Path $callerDirectory -ChildPath '.github\auto-release.yml' + } + @' +DefaultBump: major +WhatIf: false +'@ | Set-Content -LiteralPath '.github\auto-release.yml' + + { & $mainPath } | Should -Throw '*auto-release.yml*no longer supported*release.settings.yml*' + Should -Invoke gh -Times 0 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'preserves an intentional custom settings path without adding discovery or fallback' { + 'DefaultBump: major' | Set-Content -LiteralPath '.github\auto-release.yml' + 'DefaultBump: major' | Set-Content -LiteralPath '.github\release.settings.yml' + $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile = Join-Path -Path $callerDirectory -ChildPath 'custom.settings.yml' + @' +DefaultBump: minor +WhatIf: false +'@ | Set-Content -LiteralPath $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = 'WhatIf: true' + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Reading from configuration file .*custom\.settings\.yml' + $output | Should -Match 'Default bump:\s+\[minor\]' + $output | Should -Match 'gh release create v2\.1\.0 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'does not ignore legacy settings when an explicitly selected custom file is missing' { + $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile = 'missing.settings.yml' + 'DefaultBump: major' | Set-Content -LiteralPath '.github\auto-release.yml' + + { & $mainPath } | Should -Throw '*auto-release.yml*no longer supported*release.settings.yml*ConfigurationFile*' + Should -Invoke gh -Times 0 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'retains scope precedence when the new default file is selected without injection' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'patch' + @' +DefaultBump: major +WhatIf: false +'@ | Set-Content -LiteralPath '.github\release.settings.yml' + $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = @' +DefaultBump: minor +WhatIf: true +'@ + $githubEvent.pull_request.labels = @(@{ name = 'release:patch' }) + $githubEvent | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $env:GITHUB_EVENT_PATH + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Reading from configuration file .*release\.settings\.yml' + $output | Should -Match 'Default bump:\s+\[minor\]' + $output | Should -Match 'Default bump source:\s+\[CallerOverride\]' + $output | Should -Match 'Bump source:\s+\[release:patch\]' + $output | Should -Match 'gh release create v2\.0\.4 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + + It 'rejects invalid data in the new default file before contacting GitHub' -ForEach @( + @{ Yaml = 'DefaultBump: date'; Message = '*Invalid DefaultBump*' } + @{ Yaml = 'DefaultBump: null'; Message = '*DefaultBump*' } + @{ Yaml = 'WhatIf: invalid'; Message = '*WhatIf*true or false*' } + @{ Yaml = 'AutoPatching: false'; Message = '*AutoPatching*removed*' } + @{ Yaml = '- patch'; Message = '*configuration must be a mapping*' } + @{ Yaml = ''; Message = '*configuration*must be a mapping*' } + ) { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + $Yaml | Set-Content -LiteralPath '.github\release.settings.yml' + $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = 'DefaultBump: patch' + + { & $mainPath } | Should -Throw $Message + Should -Invoke gh -Times 0 -Exactly + Should -Invoke git -Times 0 -Exactly + } + It 'uses action.yml defaults without relying on the composite wrapper to inject them' { $output = (& $mainPath) -join "`n" From a907ca3c65caee8ce270abe923bf7309f5ffea5a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 09:51:57 +0100 Subject: [PATCH 2/8] Verify named inputs with the conventional settings file --- tests/Release-GHRepository.Tests.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index ef9b5bf..04707f3 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -219,17 +219,15 @@ WhatIf: false Should -Invoke git -Times 0 -Exactly } - It 'retains scope precedence when the new default file is selected without injection' { + It 'applies named inputs over the conventional file before an owned bump' { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile - $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'patch' + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'minor' + $env:PSMODULE_AUTO_RELEASE_INPUT_AutoCleanup = 'false' @' DefaultBump: major -WhatIf: false -'@ | Set-Content -LiteralPath '.github\release.settings.yml' - $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = @' -DefaultBump: minor +AutoCleanup: true WhatIf: true -'@ +'@ | Set-Content -LiteralPath '.github\release.settings.yml' $githubEvent.pull_request.labels = @(@{ name = 'release:patch' }) $githubEvent | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $env:GITHUB_EVENT_PATH @@ -237,7 +235,7 @@ WhatIf: true $output | Should -Match 'Reading from configuration file .*release\.settings\.yml' $output | Should -Match 'Default bump:\s+\[minor\]' - $output | Should -Match 'Default bump source:\s+\[CallerOverride\]' + $output | Should -Match 'Auto cleanup enabled:\s+\[False\]' $output | Should -Match 'Bump source:\s+\[release:patch\]' $output | Should -Match 'gh release create v2\.0\.4 ' Should -Invoke gh -Times 2 -Exactly From ca8db5d1cde78c380aece4262ec8b8bf482b8ff4 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 09:53:15 +0100 Subject: [PATCH 3/8] Use named inputs in filename migration controls --- tests/Release-GHRepository.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index 04707f3..d479ccf 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -199,7 +199,7 @@ WhatIf: false DefaultBump: minor WhatIf: false '@ | Set-Content -LiteralPath $env:PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile - $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = 'WhatIf: true' + $env:PSMODULE_AUTO_RELEASE_INPUT_WhatIf = 'true' $output = (& $mainPath) -join "`n" @@ -252,7 +252,7 @@ WhatIf: true ) { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile $Yaml | Set-Content -LiteralPath '.github\release.settings.yml' - $env:PSMODULE_AUTO_RELEASE_INPUT_CallerOverrides = 'DefaultBump: patch' + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'patch' { & $mainPath } | Should -Throw $Message Should -Invoke gh -Times 0 -Exactly From 6bd810b0ae7d604e0782cfba271833367c3bff8f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 09:54:56 +0100 Subject: [PATCH 4/8] Verify empty named settings with the canonical file --- tests/Release-GHRepository.Tests.ps1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index d479ccf..5e1d85f 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -242,6 +242,27 @@ WhatIf: true Should -Invoke git -Times 0 -Exactly } + It 'clears conventional-file text settings through explicit empty named inputs' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix = '' + $env:PSMODULE_AUTO_RELEASE_INPUT_DatePrereleaseFormat = '' + @' +DefaultBump: minor +VersionPrefix: release- +DatePrereleaseFormat: yyyyMMdd +WhatIf: true +'@ | Set-Content -LiteralPath '.github\release.settings.yml' + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Reading from configuration file .*release\.settings\.yml' + $output | Should -Match 'Version prefix:\s+\[\]' + $output | Should -Match 'Date-based prerelease format:\s+\[\]' + $output | Should -Match 'gh release create 2\.1\.0 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + It 'rejects invalid data in the new default file before contacting GitHub' -ForEach @( @{ Yaml = 'DefaultBump: date'; Message = '*Invalid DefaultBump*' } @{ Yaml = 'DefaultBump: null'; Message = '*DefaultBump*' } From eaceb5a7fcd8abe08b2fc005c980a64d45ae89a7 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 09:57:14 +0100 Subject: [PATCH 5/8] Verify named input inheritance with the canonical file --- tests/Release-GHRepository.Tests.ps1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index 5e1d85f..ff35d20 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -136,6 +136,32 @@ WhatIf: true Should -Invoke git -Times 0 -Exactly } + It 'inherits conventional-file settings when named inputs select inherit' { + Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'inherit' + $env:PSMODULE_AUTO_RELEASE_INPUT_AutoCleanup = 'inherit' + $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix = 'inherit' + $env:PSMODULE_AUTO_RELEASE_INPUT_DatePrereleaseFormat = 'inherit' + @' +DefaultBump: minor +AutoCleanup: false +VersionPrefix: '' +DatePrereleaseFormat: '' +WhatIf: true +'@ | Set-Content -LiteralPath '.github\release.settings.yml' + + $output = (& $mainPath) -join "`n" + + $output | Should -Match 'Reading from configuration file .*release\.settings\.yml' + $output | Should -Match 'Default bump:\s+\[minor\]' + $output | Should -Match 'Auto cleanup enabled:\s+\[False\]' + $output | Should -Match 'Version prefix:\s+\[\]' + $output | Should -Match 'Date-based prerelease format:\s+\[\]' + $output | Should -Match 'gh release create 2\.1\.0 ' + Should -Invoke gh -Times 2 -Exactly + Should -Invoke git -Times 0 -Exactly + } + It 'inherits valid defaults when the conventional settings file is intentionally absent' { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile From 54ce0511a6e1bab2fc14fd0681f0021a2fe0d06a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 12:25:39 +0100 Subject: [PATCH 6/8] Align the filename test with the lower path-input name --- tests/Release-GHRepository.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index e47ff8f..b84bae1 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -116,9 +116,9 @@ Describe 'Release-GHRepository caller compatibility' { } It 'declares release.settings.yml as the only conventional settings default' { - $actionDefinition.inputs.ConfigurationFile.default | Should -BeExactly '.github\release.settings.yml' - $actionDefinition.runs.steps[0].env.PSMODULE_AUTO_RELEASE_INPUT_ConfigurationFile | - Should -BeExactly '${{ inputs.ConfigurationFile }}' + $actionDefinition.inputs.SettingsFilePath.default | Should -BeExactly '.github\release.settings.yml' + $actionDefinition.runs.steps[0].env.PSMODULE_AUTO_RELEASE_INPUT_SettingsFilePath | + Should -BeExactly '${{ inputs.SettingsFilePath }}' } It 'reads the declared default without an injected ConfigurationFile input' { From edacaf3d8b05c931b4d723387eff6841cf95bc17 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 13:23:35 +0100 Subject: [PATCH 7/8] Verify default file policy for omitted and blank inputs --- tests/Release-GHRepository.Tests.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index 5dd493b..f1c6057 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -139,12 +139,12 @@ WhatIf: true Should -Invoke git -Times 0 -Exactly } - It 'inherits conventional-file settings when named inputs select inherit' { + It 'uses conventional-file policy when named inputs are omitted or blank' { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_SettingsFilePath - $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'inherit' - $env:PSMODULE_AUTO_RELEASE_INPUT_AutoCleanup = 'inherit' - $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix = 'inherit' - $env:PSMODULE_AUTO_RELEASE_INPUT_DatePrereleaseFormat = 'inherit' + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = '' + $env:PSMODULE_AUTO_RELEASE_INPUT_AutoCleanup = '' + $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix = '' + $env:PSMODULE_AUTO_RELEASE_INPUT_DatePrereleaseFormat = '' @' DefaultBump: minor AutoCleanup: false @@ -272,7 +272,7 @@ WhatIf: true Should -Invoke git -Times 0 -Exactly } - It 'clears conventional-file text settings through explicit empty named inputs' { + It 'keeps conventional-file text settings when named inputs are blank' { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_SettingsFilePath $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix = '' $env:PSMODULE_AUTO_RELEASE_INPUT_DatePrereleaseFormat = '' @@ -286,9 +286,9 @@ WhatIf: true $output = (& $mainPath) -join "`n" $output | Should -Match 'Reading settings file .*release\.settings\.yml' - $output | Should -Match 'Version prefix:\s+\[\]' - $output | Should -Match 'Date-based prerelease format:\s+\[\]' - $output | Should -Match 'gh release create 2\.1\.0 ' + $output | Should -Match 'Version prefix:\s+\[release-\]' + $output | Should -Match 'Date-based prerelease format:\s+\[yyyyMMdd\]' + $output | Should -Match 'gh release create release-2\.1\.0 ' Should -Invoke gh -Times 2 -Exactly Should -Invoke git -Times 0 -Exactly } From 0abbfc2d584a6fb23477a82fdb3eba72c770306d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Nov 2026 15:40:14 +0100 Subject: [PATCH 8/8] Cover explicit input equal to the advertised default --- tests/Release-GHRepository.Tests.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Release-GHRepository.Tests.ps1 b/tests/Release-GHRepository.Tests.ps1 index 595ec5d..cc6eea8 100644 --- a/tests/Release-GHRepository.Tests.ps1 +++ b/tests/Release-GHRepository.Tests.ps1 @@ -275,26 +275,26 @@ WhatIf: false Should -Invoke git -Times 0 -Exactly } - It 'applies named inputs over the conventional file before an owned bump' { + It 'applies an explicit standard-valued input before an owned bump' { Remove-Item -LiteralPath Env:\PSMODULE_AUTO_RELEASE_INPUT_SettingsFilePath - $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'minor' + $env:PSMODULE_AUTO_RELEASE_INPUT_DefaultBump = 'patch' $env:PSMODULE_AUTO_RELEASE_INPUT_AutoCleanup = 'false' @' DefaultBump: major AutoCleanup: true WhatIf: true '@ | Set-Content -LiteralPath '.github\release.settings.yml' - $githubEvent.pull_request.labels = @(@{ name = 'release:patch' }) + $githubEvent.pull_request.labels = @(@{ name = 'release:minor' }) $githubEvent | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $env:GITHUB_EVENT_PATH $output = (& $mainPath) -join "`n" $output | Should -Match 'Reading settings file .*release\.settings\.yml' - $output | Should -Match 'Default bump:\s+\[minor\]' + $output | Should -Match 'Default bump:\s+\[patch\]' $output | Should -Match 'Default bump source:\s+\[ActionInput\]' $output | Should -Match 'Auto cleanup enabled:\s+\[False\]' - $output | Should -Match 'Bump source:\s+\[release:patch\]' - $output | Should -Match 'gh release create v2\.0\.4 ' + $output | Should -Match 'Bump source:\s+\[release:minor\]' + $output | Should -Match 'gh release create v2\.1\.0 ' Should -Invoke gh -Times 2 -Exactly Should -Invoke git -Times 0 -Exactly }