diff --git a/eng/scripts/Get-TypeSpec-Folders.ps1 b/eng/scripts/Get-TypeSpec-Folders.ps1 index e6f22dfb619b..cd0454c1c8d0 100644 --- a/eng/scripts/Get-TypeSpec-Folders.ps1 +++ b/eng/scripts/Get-TypeSpec-Folders.ps1 @@ -7,7 +7,7 @@ Set-StrictMode -Version 3 . $PSScriptRoot/ChangedFiles-Functions.ps1 $repoPath = Resolve-Path "$PSScriptRoot/../.." -$checkAllPath = "specification" +$checkAllPath = ((Get-ChildItem "specification" -Directory).Name -replace '^', 'specification/') -replace '$', '/' if ($CheckAll) { $changedFiles = $checkAllPath @@ -28,9 +28,9 @@ else { $typespecFolders = @() $skippedTypespecFolders = @() foreach ($file in $changedFiles) { - if ($file -match 'specification(\/[^\/]*\/)*') { + if ($file -match 'specification(\/[^\/]+\/)+') { $path = "$repoPath/$($matches[0])" - if (Test-Path $path) { + if (Test-Path $path) { Write-Verbose "Checking for tspconfig files under $path" $typespecFolder = Get-ChildItem -path $path tspconfig.* -Recurse if ($typespecFolder) {