Skip to content

Commit 2e2309b

Browse files
authored
python-pullrequest handles changes in sdk or sdk/<service> that are not actually packages (#37825)
1 parent f466161 commit 2e2309b

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

eng/scripts/Language-Settings.ps1

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,24 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
3333
return $startsWith
3434
}
3535

36+
$changedServices = @()
37+
foreach($file in $diffObj.ChangedFiles) {
38+
$pathComponents = $file -split "/"
39+
# handle changes only in sdk/<service>/<file>/<extension>
40+
if ($pathComponents.Length -eq 3 -and $pathComponents[0] -eq "sdk") {
41+
$changedServices += $pathComponents[1]
42+
}
43+
44+
# handle any changes under sdk/<file>.<extension>
45+
if ($pathComponents.Length -eq 2 -and $pathComponents[0] -eq "sdk") {
46+
changedServices += "template"
47+
}
48+
}
49+
3650
$toolChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("tool")}
3751
$engChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("eng")}
3852
$othersChanged = $diffObj.ChangedFiles | Where-Object { isOther($_) }
53+
$changedServices = $changedServices | Get-Unique
3954

4055
if ($toolChanged) {
4156
$additionalPackages = @(
@@ -73,16 +88,21 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
7388
$additionalValidationPackages += $additionalPackages
7489
}
7590

91+
foreach ($changedService in $changedServices) {
92+
$additionalPackages = $AllPkgProps | Where-Object { $_.ServiceDirectory -eq $changedService }
93+
$additionalValidationPackages += $additionalPackages
94+
}
95+
7696
$uniqueResultSet = @()
77-
foreach($pkg in $additionalPackages) {
97+
foreach ($pkg in $additionalValidationPackages) {
7898
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
7999
$pkg.IncludedForValidation = $true
80100
$uniqueResultSet += $pkg
81101
}
82102
}
83103

84104
Write-Host "Returning additional packages for validation: $($uniqueResultSet.Count)"
85-
foreach($pkg in $uniqueResultSet) {
105+
foreach ($pkg in $uniqueResultSet) {
86106
Write-Host " - $($pkg.Name)"
87107
}
88108

0 commit comments

Comments
 (0)