From 929f159366ae5eb08591636872657c02ea4e52a2 Mon Sep 17 00:00:00 2001 From: Patrick Hallisey Date: Fri, 30 Aug 2024 16:09:00 -0700 Subject: [PATCH] Avoid adding the same package twice, use TrimStart instead of substring --- eng/common/scripts/Package-Properties.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 6a70070beb56..e3cea7d392eb 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -119,7 +119,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) { foreach ($pkg in $allPackageProperties) { $pkgDirectory = Resolve-Path "$($pkg.DirectoryPath)" - $lookupKey = ($pkg.DirectoryPath).Replace($RepoRoot, "").SubString(1) + $lookupKey = ($pkg.DirectoryPath).Replace($RepoRoot, "").TrimStart('\/') $lookup[$lookupKey] = $pkg foreach ($file in $targetedFiles) @@ -132,12 +132,15 @@ function Get-PrPkgProperties([string]$InputDiffJson) { if ($pkg.AdditionalValidationPackages) { $additionalValidationPackages += $pkg.AdditionalValidationPackages } + + # avoid adding the same package multiple times + break } } } foreach ($addition in $additionalValidationPackages) { - $key = $addition.Replace($RepoRoot, "").SubString(1) + $key = $addition.Replace($RepoRoot, "").TrimStart('\/') if ($lookup[$key]) { $packagesWithChanges += $lookup[$key]