From 401150f303c3694f99f8d56cb33a5f5fcc2dd4f7 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 17 Jan 2025 13:23:16 -0800 Subject: [PATCH] handle only deleted files in a - pullrequest build --- eng/common/scripts/Generate-PR-Diff.ps1 | 2 ++ eng/common/scripts/Package-Properties.ps1 | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/eng/common/scripts/Generate-PR-Diff.ps1 b/eng/common/scripts/Generate-PR-Diff.ps1 index e010e176399d..4e34032c47c8 100644 --- a/eng/common/scripts/Generate-PR-Diff.ps1 +++ b/eng/common/scripts/Generate-PR-Diff.ps1 @@ -48,6 +48,7 @@ $changedFiles = @() $changedServices = @() $changedFiles = Get-ChangedFiles -DiffPath $TargetPath +$deletedFiles = Get-ChangedFiles -DiffPath $TargetPath -DiffFilterType "D" if ($changedFiles) { $changedServices = Get-ChangedServices -ChangedFiles $changedFiles @@ -63,6 +64,7 @@ $result = [PSCustomObject]@{ "ChangedFiles" = $changedFiles "ChangedServices" = $changedServices "ExcludePaths" = $ExcludePaths + "DeletedFiles" = $deletedFiles "PRNumber" = if ($env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER) { $env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER } else { "-1" } } diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index bc7b5738e2d3..a23ee76bbda6 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -162,6 +162,14 @@ function Get-PrPkgProperties([string]$InputDiffJson) { $allPackageProperties = Get-AllPkgProperties $diff = Get-Content $InputDiffJson | ConvertFrom-Json $targetedFiles = $diff.ChangedFiles + + if ($diff.DeletedFiles) { + if (-not $targetedFiles) { + $targetedFiles = @() + } + $targetedFiles += $diff.DeletedFiles + } + # The exclude paths and the targeted files paths aren't full OS paths, they're # GitHub paths meaning they're relative to the repo root and slashes are forward # slashes "/". The ExcludePaths need to have a trailing slash added in order