Sync eng/common directory with azure-sdk-tools for PR 9823 (#6419)

* handle defaults for changedfiles, deletedfiles, and changedServices

---------

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
This commit is contained in:
Azure SDK Bot 2025-02-13 11:37:40 -08:00 committed by GitHub
parent a5e9424161
commit e4dae4e2a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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