From afcd155654094ce2047c3e2e2c12ca77273aa4ea Mon Sep 17 00:00:00 2001 From: Albert Cheng <38804567+ckairen@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:21:07 -0700 Subject: [PATCH] [TypeSpec Validation] Remove duplicate error messages in Get-TypeSpec-Folders.ps1 (#25846) - Continuation of #25841 --- eng/scripts/Get-TypeSpec-Folders.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Get-TypeSpec-Folders.ps1 b/eng/scripts/Get-TypeSpec-Folders.ps1 index f2ee0f0dcbae..27b7895c6820 100644 --- a/eng/scripts/Get-TypeSpec-Folders.ps1 +++ b/eng/scripts/Get-TypeSpec-Folders.ps1 @@ -49,17 +49,22 @@ else { } $typespecFolders = @() +$skippedTypespecFolders = @() foreach ($file in $changedFiles) { if ($file -match 'specification\/[^\/]*\/') { if (Test-Path $matches[0]) { $typespecFolder = (Get-ChildItem -path $matches[0] tspconfig.* -Recurse).Directory.FullName | ForEach-Object {if ($_) { [IO.Path]::GetRelativePath($($pwd.path), $_) }} $typespecFolders += $typespecFolder -replace '\\', '/' } else { - Write-Host "Cannot find directory $($matches[0])" + $skippedTypespecFolders += $matches[0] } } } +foreach ($skippedTypespecFolder in $skippedTypespecFolders | Select-Object -Unique) { + Write-Host "Cannot find directory $skippedTypespecFolder" +} + $typespecFolders = $typespecFolders | Select-Object -Unique | Sort-Object return $typespecFolders