From ab9e1a771a269fcec2fb4cf48afc87edb672f294 Mon Sep 17 00:00:00 2001 From: Albert Cheng <38804567+ckairen@users.noreply.github.com> Date: Tue, 24 Oct 2023 09:51:42 -0700 Subject: [PATCH] [TypeSpec Validation] Fixes "trigger on only specification/ (#26276)" (#26321) * test * fix * cleanup * fix checkall scenario * testing * cleanup * cleanup * test run * test run * test run * Revert "test run" This reverts commit 06ba8dbc647be0e543beadd6167d74b33ca3ba01. * Revert "test run" This reverts commit a0f024a4dd72744b3a8c1d04907cf56ab2a859f7. * Revert "test run" This reverts commit fe26671b30b3c821ec00f42cea83499c3f7edc00. --- eng/scripts/Get-TypeSpec-Folders.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) {