File tree Expand file tree Collapse file tree 2 files changed +39
-6
lines changed
pipelines/templates/stages Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -193,15 +193,20 @@ stages:
193193 OpenAsDraft : ${{ parameters.TestPipeline }}
194194 CloseAfterOpenForTesting : ' ${{ parameters.TestPipeline }}'
195195
196+ # Workaround: -Fallback uses names from CODEOWNERS who
197+ # should be notified about the release in the event of a
198+ # failure to resolve the appropriate aliases.
196199 - pwsh : |
197- $codeOwnersToNotify = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 `
198- -TargetDirectory "/sdk/${{ parameters.ServiceDirectory }}/" `
199- -CodeownersFileLocation "$(Build.SourcesDirectory)/.github/CODEOWNERS"
200+ $notifyUsers = ./eng/scripts/Get-TriggeringUserGitHubAlias.ps1 `
201+ -EmailAddress '$(Build.RequestedForEmail)' `
202+ -ClientId '$(opensource-aad-app-id)' `
203+ -ClientSecret '$(opensource-aad-secret)' `
204+ -TenantId '$(opensource-aad-tenant-id)' `
205+ -Fallback '@rickwinter @ahsonkhan @antkmsft @vhvb1989 @gearama @LarryOsterman'
200206
201207 $prComment = "Adding ${{ artifact.Name }} to release"
202- if ($codeOwnersToNotify) {
203- $codeOwners = $codeOwnersToNotify.ForEach({ "@$_" }) -join ", "
204- $prComment += "`n`ncc: $codeOwners"
208+ if ($notifyUsers) {
209+ $prComment += "`n`ncc: $notifyUsers"
205210 }
206211
207212 ./eng/common/scripts/Add-IssueComment.ps1 `
Original file line number Diff line number Diff line change 1+ param (
2+ [string ] $EmailAddress = $env: BUILD_REQUESTEDFOREMAIL ,
3+ [string ] $ClientId ,
4+ [string ] $ClientSecret ,
5+ [string ] $TenantId ,
6+ [string ] $Fallback
7+ )
8+
9+ . " $PSScriptRoot /../common/scripts/Helpers/Metadata-Helpers.ps1"
10+
11+ $allUsers = GetAllGitHubUsers `
12+ - TenantId $TenantId `
13+ - ClientId $ClientId `
14+ - ClientSecret $ClientSecret
15+
16+ if (! $allUsers ) {
17+ Write-Host " Failed to get all GitHub users"
18+ return $Fallback
19+ }
20+
21+ $targetUser = $allUsers.Where ({ $_.aad.userPrincipalName -eq $EmailAddress -and $_.github.login }, ' First' )
22+
23+ if (! $targetUser ) {
24+ Write-Host " Failed to find GitHub user for $EmailAddress "
25+ return $Fallback
26+ }
27+
28+ return " @$ ( $targetUser.github.login ) "
You can’t perform that action at this time.
0 commit comments