@@ -173,37 +173,29 @@ function Deploy-Accelerator {
173173
174174 # Determine if any input files are YAML to check for powershell-yaml module
175175 $hasYamlFiles = $false
176+ $pathsToCheck = @ ()
177+
176178 if ($inputConfigFilePaths.Length -gt 0 ) {
177- foreach ($path in $inputConfigFilePaths ) {
178- if ($null -ne $path -and $path.Trim () -ne " " ) {
179- try {
180- $extension = [System.IO.Path ]::GetExtension($path ).ToLower()
181- if ($extension -eq " .yml" -or $extension -eq " .yaml" ) {
182- $hasYamlFiles = $true
183- break
184- }
185- } catch {
186- # Ignore invalid paths - they will be caught later during config file validation
187- continue
188- }
189- }
190- }
179+ $pathsToCheck = $inputConfigFilePaths
191180 } else {
192181 # Check environment variable if no paths provided
193182 $envInputConfigPaths = $env: ALZ_input_config_path
194183 if ($null -ne $envInputConfigPaths -and $envInputConfigPaths -ne " " ) {
195- $envPaths = $envInputConfigPaths -split " ," | Where-Object { $_ -and $_.Trim () }
196- foreach ( $path in $envPaths ) {
197- try {
198- $extension = [ System.IO.Path ]::GetExtension( $path ).ToLower()
199- if ( $extension -eq " .yml " -or $extension -eq " .yaml " ) {
200- $hasYamlFiles = $true
201- break
202- }
203- } catch {
204- # Ignore invalid paths - they will be caught later during config file validation
205- continue
184+ $pathsToCheck = $envInputConfigPaths -split " ," | Where-Object { $_ -and $_.Trim () }
185+ }
186+ }
187+
188+ foreach ( $path in $pathsToCheck ) {
189+ if ( $null -ne $path -and $path .Trim () -ne " " ) {
190+ try {
191+ $extension = [ System.IO.Path ]::GetExtension( $path ).ToLower()
192+ if ( $extension -eq " .yml " -or $extension -eq " .yaml " ) {
193+ $hasYamlFiles = $true
194+ break
206195 }
196+ } catch {
197+ # Ignore invalid paths - they will be caught later during config file validation
198+ continue
207199 }
208200 }
209201 }
0 commit comments