Skip to content

Commit

Permalink
Avoid adding the same package twice, use TrimStart instead of substri…
Browse files Browse the repository at this point in the history
…ng (#45782)

Co-authored-by: Patrick Hallisey <[email protected]>
  • Loading branch information
azure-sdk and hallipr authored Sep 3, 2024
1 parent d97a00a commit 7792610
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]
Expand Down

0 comments on commit 7792610

Please sign in to comment.