Skip to content

Commit 14b3bb2

Browse files
Refactor settings file path handling to use resolved path variable
1 parent af4f33c commit 14b3bb2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/main.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
$testPath = Resolve-Path -Path "$PSScriptRoot/tests/PSScriptAnalyzer" | Select-Object -ExpandProperty Path
33
$path = [string]::IsNullOrEmpty($env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path) ? '.' : $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path
44
$codePath = Resolve-Path -Path $path | Select-Object -ExpandProperty Path
5+
$settingsFilePath = Resolve-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath | Select-Object -ExpandProperty Path
56

67
[pscustomobject]@{
78
CodePath = $codePath
89
TestPath = $testPath
9-
SettingsFilePath = $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath
10+
SettingsFilePath = $settingsFilePath
1011
} | Format-List | Out-String
1112

12-
if (!(Test-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath)) {
13-
Write-Error "Settings file not found at path: $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath"
13+
if (!(Test-Path -Path $settingsFilePath)) {
14+
Write-Error "Settings file not found at path: $settingsFilePath"
1415
exit 1
1516
}
1617

1718
Set-GitHubOutput -Name CodePath -Value $codePath
1819
Set-GitHubOutput -Name TestPath -Value $testPath
19-
Set-GitHubOutput -Name SettingsFilePath -Value $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath
20+
Set-GitHubOutput -Name SettingsFilePath -Value $settingsFilePath

0 commit comments

Comments
 (0)