Update to use opensource api token (#5668)

This commit is contained in:
Wes Haggard 2024-05-29 13:08:26 -07:00 коммит произвёл GitHub
Родитель dc64ca6eb3
Коммит 7dedba1a4f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 15 добавлений и 10 удалений

1
.vscode/cspell.json поставляемый
Просмотреть файл

@ -199,6 +199,7 @@
"pkcs",
"Pkcs",
"pscredential",
"pscore",
"psscriptanalyzer",
"PUCHAR",
"PVOID",

Просмотреть файл

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

Просмотреть файл

@ -1,17 +1,12 @@
param(
[string] $EmailAddress = $env:BUILD_REQUESTEDFOREMAIL,
[string] $ClientId,
[string] $ClientSecret,
[string] $TenantId,
[string] $OpenApiToken,
[string] $Fallback
)
. "$PSScriptRoot/../common/scripts/Helpers/Metadata-Helpers.ps1"
$allUsers = GetAllGitHubUsers `
-TenantId $TenantId `
-ClientId $ClientId `
-ClientSecret $ClientSecret
$allUsers = GetAllGitHubUsers -Token $OpenApiToken
if (!$allUsers) {
Write-Host "Failed to get all GitHub users"