handle only deleted files in a <language> - pullrequest build (#6359)

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
This commit is contained in:
Azure SDK Bot 2025-01-21 15:16:43 -08:00 committed by GitHub
parent 4d8c32d22a
commit 12d9e66e4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

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

View File

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