Skip to content

Commit 69c6c7e

Browse files
Sync eng/common directory with azure-sdk-tools for PR 16726 (#27384)
* Exclude service folder root level files * Updated comment and fixed indentation --------- Co-authored-by: Ray Chen <raychen@microsoft.com>
1 parent 9d71b7c commit 69c6c7e

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

eng/common/scripts/AutoRelease-Operations.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ function Get-GitHubAutoReleasePullRequestForCommit {
8787
# PullRequestNumber : the PR number recorded in the diff object.
8888
# PullRequestFiles : the file entries returned by Get-GitHubPullRequestFiles.
8989
# ExcludePaths : optional paths to record on the diff object.
90+
# ExcludeServiceRootFiles : excludes files directly under sdk/<service> so they do not resolve every
91+
# package in that service.
9092
#
9193
# Returns a PSCustomObject with ChangedFiles, ChangedServices, ExcludePaths, DeletedFiles, PRNumber.
9294
function New-GitHubPullRequestDiffObject {
@@ -97,7 +99,8 @@ function New-GitHubPullRequestDiffObject {
9799
[AllowEmptyCollection()]
98100
[array] $PullRequestFiles,
99101
[AllowEmptyCollection()]
100-
[array] $ExcludePaths = @()
102+
[array] $ExcludePaths = @(),
103+
[switch] $ExcludeServiceRootFiles
101104
)
102105

103106
$changedFiles = @()
@@ -119,6 +122,12 @@ function New-GitHubPullRequestDiffObject {
119122
}
120123
}
121124

125+
if ($ExcludeServiceRootFiles) {
126+
$serviceRootFilePattern = '^sdk/[^/]+/[^/]+$'
127+
$changedFiles = @($changedFiles | Where-Object { $_ -notmatch $serviceRootFilePattern })
128+
$deletedFiles = @($deletedFiles | Where-Object { $_ -notmatch $serviceRootFilePattern })
129+
}
130+
122131
$changedFiles = @($changedFiles | Where-Object { $_ } | Sort-Object -Unique)
123132
$deletedFiles = @($deletedFiles | Where-Object { $_ } | Sort-Object -Unique)
124133

eng/common/scripts/Resolve-AutoReleasePackages.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ commit, this script:
1010
'auto-release' label.
1111
2. Builds a PR diff object (New-GitHubPullRequestDiffObject) from the PR's changed files and reuses
1212
the repo's existing package-detection logic (Get-PrPkgProperties) to identify the changed packages
13-
(honoring triggering paths, deleted files and service-level changes), excluding
14-
validation-only packages. Get-PrPkgProperties delegates to each repo's own
13+
(honoring triggering paths and deleted files while ignoring only files directly under
14+
sdk/<service>/, not files in package subdirectories), excluding validation-only packages.
15+
Get-PrPkgProperties delegates to each repo's own
1516
Get-AllPackageInfoFromRepo (language-settings.ps1), so this script works for any language repo.
1617
3. Intersects those packages with this pipeline's declared artifacts and emits Azure DevOps output
1718
variables consumed by the release stages. Both consumption styles are emitted:
@@ -135,7 +136,10 @@ function Invoke-AutoReleaseResolution {
135136
# package-detection logic to identify the changed packages.
136137
Write-Host "Fetching changed files for PR $prLink..."
137138
$files = @(Get-GitHubPullRequestFiles -RepoId $RepoId -PullRequestNumber $pr.number -AuthToken $AuthToken)
138-
$diff = New-GitHubPullRequestDiffObject -PullRequestNumber $pr.number -PullRequestFiles $files
139+
$diff = New-GitHubPullRequestDiffObject `
140+
-PullRequestNumber $pr.number `
141+
-PullRequestFiles $files `
142+
-ExcludeServiceRootFiles
139143
Write-Host "PR $prLink changed $($diff.ChangedFiles.Count) file(s) and deleted $($diff.DeletedFiles.Count) file(s)."
140144

141145
$diffPath = Join-Path ([System.IO.Path]::GetTempPath()) ("autorelease-diff-" + [System.Guid]::NewGuid().ToString('N') + ".json")

0 commit comments

Comments
 (0)