Skip to content

Commit af4f33c

Browse files
Refactor settings file path handling to use environment variable directly
1 parent 1ffbf28 commit af4f33c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/main.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
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 = Join-Path -Path $codePath -ChildPath $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath
65

76
[pscustomobject]@{
87
CodePath = $codePath
98
TestPath = $testPath
10-
SettingsFilePath = $settingsFilePath
9+
SettingsFilePath = $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath
1110
} | Format-List | Out-String
1211

13-
if (!(Test-Path -Path $settingsFilePath)) {
14-
Write-Error "Settings file not found at path: $settingsFilePath"
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"
1514
exit 1
1615
}
1716

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

0 commit comments

Comments
 (0)