Skip to content

Commit 7dedba1

Browse files
authored
Update to use opensource api token (#5668)
1 parent dc64ca6 commit 7dedba1

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.vscode/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
"pkcs",
200200
"Pkcs",
201201
"pscredential",
202+
"pscore",
202203
"psscriptanalyzer",
203204
"PUCHAR",
204205
"PVOID",

eng/pipelines/templates/stages/archetype-cpp-release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,24 @@ stages:
195195
OpenAsDraft: ${{ parameters.TestPipeline }}
196196
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'
197197

198+
- task: AzureCLI@2
199+
displayName: Authenticate to OpenSource API
200+
condition: and(succeeded(), eq(variables['PublishToVcpkg'], 'true'))
201+
inputs:
202+
azureSubscription: opensource-api-connection
203+
scriptType: pscore
204+
scriptLocation: inlineScript
205+
inlineScript: |
206+
$jwt_accessToken = az account get-access-token --resource "api://2789159d-8d8b-4d13-b90b-ca29c1707afd" --query "accessToken" --output tsv
207+
Write-Host "##vso[task.setvariable variable=opensource-api-token;isSecret=true]$jwt_accessToken"
208+
198209
# Workaround: -Fallback uses names from CODEOWNERS who
199210
# should be notified about the release in the event of a
200211
# failure to resolve the appropriate aliases.
201212
- pwsh: |
202213
$notifyUsers = ./eng/scripts/Get-TriggeringUserGitHubAlias.ps1 `
203214
-EmailAddress "$($env:BUILD_REQUESTEDFOREMAIL)" `
204-
-ClientId '$(opensource-aad-app-id)' `
205-
-ClientSecret '$(opensource-aad-secret)' `
206-
-TenantId '$(opensource-aad-tenant-id)' `
215+
-OpenApiToken "$(opensource-api-token)" `
207216
-Fallback '@rickwinter @ahsonkhan @antkmsft @gearama @LarryOsterman'
208217
209218
$prComment = "Adding ${{ artifact.Name }} to release"

eng/scripts/Get-TriggeringUserGitHubAlias.ps1

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
param(
22
[string] $EmailAddress = $env:BUILD_REQUESTEDFOREMAIL,
3-
[string] $ClientId,
4-
[string] $ClientSecret,
5-
[string] $TenantId,
3+
[string] $OpenApiToken,
64
[string] $Fallback
75
)
86

97
. "$PSScriptRoot/../common/scripts/Helpers/Metadata-Helpers.ps1"
108

11-
$allUsers = GetAllGitHubUsers `
12-
-TenantId $TenantId `
13-
-ClientId $ClientId `
14-
-ClientSecret $ClientSecret
9+
$allUsers = GetAllGitHubUsers -Token $OpenApiToken
1510

1611
if (!$allUsers) {
1712
Write-Host "Failed to get all GitHub users"

0 commit comments

Comments
 (0)