diff --git a/eng/common/scripts/Generate-PR-Diff.ps1 b/eng/common/scripts/Generate-PR-Diff.ps1 index 4e34032c4..50f6ec2b2 100644 --- a/eng/common/scripts/Generate-PR-Diff.ps1 +++ b/eng/common/scripts/Generate-PR-Diff.ps1 @@ -53,6 +53,10 @@ $deletedFiles = Get-ChangedFiles -DiffPath $TargetPath -DiffFilterType "D" if ($changedFiles) { $changedServices = Get-ChangedServices -ChangedFiles $changedFiles } +else { + # ensure we default this to an empty array if not set + $changedFiles = @() +} # ExcludePaths is an object array with the default of [] which evaluates to null. # If the value is null, set it to empty list to ensure that the empty list is @@ -60,6 +64,12 @@ if ($changedFiles) { if (-not $ExcludePaths) { $ExcludePaths = @() } +if (-not $deletedFiles) { + $deletedFiles = @() +} +if (-not $changedServices) { + $changedServices = @() +} $result = [PSCustomObject]@{ "ChangedFiles" = $changedFiles "ChangedServices" = $changedServices