Skip to content

Commit

Permalink
handle only deleted files in a <language> - pullrequest build
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd authored and azure-sdk committed Jan 17, 2025
1 parent 9033aa4 commit 5908cff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eng/common/scripts/Generate-PR-Diff.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" }
}

Expand Down
8 changes: 8 additions & 0 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5908cff

Please sign in to comment.