Skip to content
Draft
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
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Each setting has a matching named input and an effective standard in its descrip
| Name | Description | Effective default | Required |
| --- | --- | --- | --- |
| `AutoCleanup` | Delete prereleases after the pull request closes. | `true` | false |
| `SettingsFilePath` | Select the repository settings file before startup. | `.github\auto-release.yml` | false |
| `SettingsFilePath` | Select the repository settings file before startup. | `.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 |
Expand All @@ -111,7 +111,11 @@ Use the `release:prerelease` label to select repository prerelease behavior. The

### Settings file path

The default repository settings file path is `.github\auto-release.yml`. Use `SettingsFilePath` to select a custom file. Omit this selector to use the default path; an empty or whitespace-only path is invalid. Literal paths with spaces or brackets are supported. A directory or a non-file-system provider is not a settings file. If the selected file is absent, valid standards and nonempty named inputs remain effective.
The default repository settings file path is `.github\release.settings.yml`. Use `SettingsFilePath` to select a custom file. Omit this selector to use the default path. An empty or whitespace-only path is invalid. The action supports literal paths with spaces or brackets. A directory or a non-file-system provider is not a settings file.

The removed `.github\auto-release.yml` path has no fallback or alias, even when you select it explicitly. The bootstrap checks that path in the initial directory, before GitHub-Script starts. If the old file exists and you select the default path, startup fails. An existing custom file remains supported. If a custom file is missing and the old file exists, startup also fails.

If the selected file and the old default file are both absent, valid standards and nonempty named inputs remain effective. A file-defined `WorkingDirectory` does not change file selection or the location of the old-file check.

File selection and execution follow this order:

Expand All @@ -133,6 +137,7 @@ There is no reserved omission value. Nonempty inputs go through normal validatio
The repository file must contain a mapping of supported settings. Every input in the table except `SettingsFilePath` is a valid file key. The file can contain only the settings that differ from the standards. Unknown keys, removed keys, null values, and invalid values fail before GitHub-Script starts. A valid override cannot hide an invalid lower layer.

```yaml
# .github\release.settings.yml
DatePrereleaseFormat: 'yyyyMMddHHmm'
DefaultBump: patch
IncrementalPrerelease: false
Expand All @@ -144,6 +149,13 @@ Prerelease: false
WorkingDirectory: '.'
```

For an intentional custom path:

```yaml
with:
SettingsFilePath: .github\custom-release.settings.yml
```

For an invocation-specific minor bump, even when the repository configures major:

```yaml
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
Select the repository settings file before startup. Relative paths use an explicit WorkingDirectory,
otherwise github.workspace. Nonempty named inputs override file values; omitted or empty inputs retain them.
required: false
default: .github\auto-release.yml
default: .github\release.settings.yml
DefaultBump:
description: >-
The release bump without an owned bump or skip label. Accepts exactly patch, minor, or major.
Expand Down
26 changes: 24 additions & 2 deletions src/Initialize-ReleaseConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ try {
$initialDirectory = ConvertTo-ReleaseSettingValue @initialParameters
}
$settingsFilePath = [Environment]::GetEnvironmentVariable('PSMODULE_AUTO_RELEASE_INPUT_SettingsFilePath')
$actionDefinition = ConvertFrom-Yaml -Yaml ([IO.File]::ReadAllText($actionDefinitionPath))
if ($null -eq $settingsFilePath) {
$actionDefinition = ConvertFrom-Yaml -Yaml ([IO.File]::ReadAllText($actionDefinitionPath))
$settingsFilePath = $actionDefinition.inputs.SettingsFilePath.default
}
$pathParameters = @{
Expand All @@ -93,12 +93,34 @@ try {
BaseDirectory = $initialDirectory
}
$settingsFilePath = Resolve-ReleaseFileSystemPath @pathParameters
$defaultPathParameters = @{
Name = 'SettingsFilePath'
Path = $actionDefinition.inputs.SettingsFilePath.default
BaseDirectory = $initialDirectory
}
$defaultConfigurationPath = Resolve-ReleaseFileSystemPath @defaultPathParameters
$legacyConfigurationPath = Join-Path -Path (Split-Path -Path $defaultConfigurationPath -Parent) -ChildPath 'auto-release.yml'
$pathComparison = [StringComparison]::Ordinal
if ($IsWindows) {
$pathComparison = [StringComparison]::OrdinalIgnoreCase
}
$usesDefaultPath = [string]::Equals($settingsFilePath, $defaultConfigurationPath, $pathComparison)
$usesLegacyPath = [string]::Equals($settingsFilePath, $legacyConfigurationPath, $pathComparison)
$configurationExists = Test-Path -LiteralPath $settingsFilePath -PathType Leaf
$legacyExists = Test-Path -LiteralPath $legacyConfigurationPath -PathType Leaf
if ($usesLegacyPath -or ($legacyExists -and ($usesDefaultPath -or -not $configurationExists))) {
throw (
"Settings path [$legacyConfigurationPath] is no longer supported. " +
"Rename or combine its policy in [$defaultConfigurationPath]. " +
'Update SettingsFilePath with a compatible action reference, or select an existing custom settings file.'
)
}
if (Test-Path -LiteralPath $settingsFilePath -PathType Container) {
throw 'SettingsFilePath must select a file, not a directory.'
}
$loggedPath = ConvertTo-Json -InputObject $settingsFilePath -Compress
$configuration = @{}
if (Test-Path -LiteralPath $settingsFilePath -PathType Leaf) {
if ($configurationExists) {
Write-Information "Reading settings file [$loggedPath]" -InformationAction Continue
$configuration = ConvertFrom-Yaml -Yaml ([IO.File]::ReadAllText($settingsFilePath))
if ($null -eq $configuration) {
Expand Down
Loading
Loading