From 8aa262e56a38aa669a677083fbb33af7bafd5e1b Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Thu, 13 Aug 2026 14:14:29 -0700 Subject: [PATCH 1/2] Exclude service folder root level files --- eng/common/scripts/AutoRelease-Operations.ps1 | 11 ++++++++++- eng/common/scripts/Resolve-AutoReleasePackages.ps1 | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eng/common/scripts/AutoRelease-Operations.ps1 b/eng/common/scripts/AutoRelease-Operations.ps1 index 511ed0241219..7fe90013690d 100644 --- a/eng/common/scripts/AutoRelease-Operations.ps1 +++ b/eng/common/scripts/AutoRelease-Operations.ps1 @@ -87,6 +87,8 @@ function Get-GitHubAutoReleasePullRequestForCommit { # PullRequestNumber : the PR number recorded in the diff object. # PullRequestFiles : the file entries returned by Get-GitHubPullRequestFiles. # ExcludePaths : optional paths to record on the diff object. +# ExcludeServiceRootFiles : excludes files directly under sdk/ so they do not resolve every +# package in that service. # # Returns a PSCustomObject with ChangedFiles, ChangedServices, ExcludePaths, DeletedFiles, PRNumber. function New-GitHubPullRequestDiffObject { @@ -97,7 +99,8 @@ function New-GitHubPullRequestDiffObject { [AllowEmptyCollection()] [array] $PullRequestFiles, [AllowEmptyCollection()] - [array] $ExcludePaths = @() + [array] $ExcludePaths = @(), + [switch] $ExcludeServiceRootFiles ) $changedFiles = @() @@ -119,6 +122,12 @@ function New-GitHubPullRequestDiffObject { } } + if ($ExcludeServiceRootFiles) { + $serviceRootFilePattern = '^sdk/[^/]+/[^/]+$' + $changedFiles = @($changedFiles | Where-Object { $_ -notmatch $serviceRootFilePattern }) + $deletedFiles = @($deletedFiles | Where-Object { $_ -notmatch $serviceRootFilePattern }) + } + $changedFiles = @($changedFiles | Where-Object { $_ } | Sort-Object -Unique) $deletedFiles = @($deletedFiles | Where-Object { $_ } | Sort-Object -Unique) diff --git a/eng/common/scripts/Resolve-AutoReleasePackages.ps1 b/eng/common/scripts/Resolve-AutoReleasePackages.ps1 index 2be70bcd53a4..c89745fa654d 100644 --- a/eng/common/scripts/Resolve-AutoReleasePackages.ps1 +++ b/eng/common/scripts/Resolve-AutoReleasePackages.ps1 @@ -10,8 +10,8 @@ commit, this script: 'auto-release' label. 2. Builds a PR diff object (New-GitHubPullRequestDiffObject) from the PR's changed files and reuses the repo's existing package-detection logic (Get-PrPkgProperties) to identify the changed packages - (honoring triggering paths, deleted files and service-level changes), excluding - validation-only packages. Get-PrPkgProperties delegates to each repo's own + (honoring triggering paths and deleted files while ignoring files directly under service folders), + excluding validation-only packages. Get-PrPkgProperties delegates to each repo's own Get-AllPackageInfoFromRepo (language-settings.ps1), so this script works for any language repo. 3. Intersects those packages with this pipeline's declared artifacts and emits Azure DevOps output variables consumed by the release stages. Both consumption styles are emitted: @@ -135,7 +135,10 @@ function Invoke-AutoReleaseResolution { # package-detection logic to identify the changed packages. Write-Host "Fetching changed files for PR $prLink..." $files = @(Get-GitHubPullRequestFiles -RepoId $RepoId -PullRequestNumber $pr.number -AuthToken $AuthToken) - $diff = New-GitHubPullRequestDiffObject -PullRequestNumber $pr.number -PullRequestFiles $files + $diff = New-GitHubPullRequestDiffObject ` + -PullRequestNumber $pr.number ` + -PullRequestFiles $files ` + -ExcludeServiceRootFiles Write-Host "PR $prLink changed $($diff.ChangedFiles.Count) file(s) and deleted $($diff.DeletedFiles.Count) file(s)." $diffPath = Join-Path ([System.IO.Path]::GetTempPath()) ("autorelease-diff-" + [System.Guid]::NewGuid().ToString('N') + ".json") From 3662afab40e461ab2820632928b6f74d54f9e49a Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Thu, 13 Aug 2026 14:45:05 -0700 Subject: [PATCH 2/2] Updated comment and fixed indentation --- eng/common/scripts/Resolve-AutoReleasePackages.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/Resolve-AutoReleasePackages.ps1 b/eng/common/scripts/Resolve-AutoReleasePackages.ps1 index c89745fa654d..06cd79a43519 100644 --- a/eng/common/scripts/Resolve-AutoReleasePackages.ps1 +++ b/eng/common/scripts/Resolve-AutoReleasePackages.ps1 @@ -10,8 +10,9 @@ commit, this script: 'auto-release' label. 2. Builds a PR diff object (New-GitHubPullRequestDiffObject) from the PR's changed files and reuses the repo's existing package-detection logic (Get-PrPkgProperties) to identify the changed packages - (honoring triggering paths and deleted files while ignoring files directly under service folders), - excluding validation-only packages. Get-PrPkgProperties delegates to each repo's own + (honoring triggering paths and deleted files while ignoring only files directly under + sdk//, not files in package subdirectories), excluding validation-only packages. + Get-PrPkgProperties delegates to each repo's own Get-AllPackageInfoFromRepo (language-settings.ps1), so this script works for any language repo. 3. Intersects those packages with this pipeline's declared artifacts and emits Azure DevOps output variables consumed by the release stages. Both consumption styles are emitted: