From 2c53d5e83dacc098b6880163ba624364be66a34a Mon Sep 17 00:00:00 2001 From: Albert Cheng <38804567+ckairen@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:50:45 -0700 Subject: [PATCH] [TypeSpec Validation] Skip deleted folders in Get-TypeSpec-Folders.ps1 (#25841) - Fixes #25839 --- eng/scripts/Get-TypeSpec-Folders.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/scripts/Get-TypeSpec-Folders.ps1 b/eng/scripts/Get-TypeSpec-Folders.ps1 index b0f7af8aaaca..f2ee0f0dcbae 100644 --- a/eng/scripts/Get-TypeSpec-Folders.ps1 +++ b/eng/scripts/Get-TypeSpec-Folders.ps1 @@ -51,8 +51,12 @@ else { $typespecFolders = @() foreach ($file in $changedFiles) { if ($file -match 'specification\/[^\/]*\/') { - $typespecFolder = (Get-ChildItem -path $matches[0] tspconfig.* -Recurse).Directory.FullName | ForEach-Object {if ($_) { [IO.Path]::GetRelativePath($($pwd.path), $_) }} - $typespecFolders += $typespecFolder -replace '\\', '/' + 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])" + } } }