Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions eng/Version.Details.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ This file should be imported by eng/Versions.props
<!-- dotnet-dotnet dependencies -->
<MicrosoftBuildFrameworkPackageVersion>15.9.20</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.9.20</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26402.102</MicrosoftDotNetArcadeSdkPackageVersion>
<MicrosoftDotNetCodeAnalysisPackageVersion>11.0.0-beta.26402.102</MicrosoftDotNetCodeAnalysisPackageVersion>
<MicrosoftDotNetGenAPIPackageVersion>11.0.0-beta.26402.102</MicrosoftDotNetGenAPIPackageVersion>
<MicrosoftDotNetHelixSdkPackageVersion>11.0.0-beta.26402.102</MicrosoftDotNetHelixSdkPackageVersion>
<MicrosoftDotnetWinFormsProjectTemplatesPackageVersion>11.0.0-rc.1.26402.102</MicrosoftDotnetWinFormsProjectTemplatesPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>11.0.0-rc.1.26402.102</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftPrivateWinformsPackageVersion>11.0.0-rc.1.26402.102</MicrosoftPrivateWinformsPackageVersion>
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26405.103</MicrosoftDotNetArcadeSdkPackageVersion>
<MicrosoftDotNetCodeAnalysisPackageVersion>11.0.0-beta.26405.103</MicrosoftDotNetCodeAnalysisPackageVersion>
<MicrosoftDotNetGenAPIPackageVersion>11.0.0-beta.26405.103</MicrosoftDotNetGenAPIPackageVersion>
<MicrosoftDotNetHelixSdkPackageVersion>11.0.0-beta.26405.103</MicrosoftDotNetHelixSdkPackageVersion>
<MicrosoftDotnetWinFormsProjectTemplatesPackageVersion>11.0.0-rc.1.26405.103</MicrosoftDotnetWinFormsProjectTemplatesPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>11.0.0-rc.1.26405.103</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftPrivateWinformsPackageVersion>11.0.0-rc.1.26405.103</MicrosoftPrivateWinformsPackageVersion>
<MicrosoftSourceLinkAzureReposGitPackageVersion>8.0.0-beta.23409.2</MicrosoftSourceLinkAzureReposGitPackageVersion>
<MicrosoftSourceLinkGitHubPackageVersion>8.0.0-beta.23409.2</MicrosoftSourceLinkGitHubPackageVersion>
<SystemCodeDomPackageVersion>11.0.0-rc.1.26402.102</SystemCodeDomPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion>11.0.0-rc.1.26402.102</SystemConfigurationConfigurationManagerPackageVersion>
<SystemDiagnosticsEventLogPackageVersion>11.0.0-rc.1.26402.102</SystemDiagnosticsEventLogPackageVersion>
<SystemDirectoryServicesPackageVersion>11.0.0-rc.1.26402.102</SystemDirectoryServicesPackageVersion>
<SystemDrawingCommonPackageVersion>11.0.0-rc.1.26402.102</SystemDrawingCommonPackageVersion>
<SystemFormatsNrbfPackageVersion>11.0.0-rc.1.26402.102</SystemFormatsNrbfPackageVersion>
<SystemIOPackagingPackageVersion>11.0.0-rc.1.26402.102</SystemIOPackagingPackageVersion>
<SystemPrivateWindowsCoreTestUtilitiesPackageVersion>11.0.0-rc.1.26402.102</SystemPrivateWindowsCoreTestUtilitiesPackageVersion>
<SystemReflectionMetadataLoadContextPackageVersion>11.0.0-rc.1.26402.102</SystemReflectionMetadataLoadContextPackageVersion>
<SystemResourcesExtensionsPackageVersion>11.0.0-rc.1.26402.102</SystemResourcesExtensionsPackageVersion>
<SystemRuntimeSerializationFormattersPackageVersion>11.0.0-rc.1.26402.102</SystemRuntimeSerializationFormattersPackageVersion>
<SystemSecurityCryptographyXmlPackageVersion>11.0.0-rc.1.26402.102</SystemSecurityCryptographyXmlPackageVersion>
<SystemSecurityPermissionsPackageVersion>11.0.0-rc.1.26402.102</SystemSecurityPermissionsPackageVersion>
<SystemWindowsExtensionsPackageVersion>11.0.0-rc.1.26402.102</SystemWindowsExtensionsPackageVersion>
<SystemCodeDomPackageVersion>11.0.0-rc.1.26405.103</SystemCodeDomPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion>11.0.0-rc.1.26405.103</SystemConfigurationConfigurationManagerPackageVersion>
<SystemDiagnosticsEventLogPackageVersion>11.0.0-rc.1.26405.103</SystemDiagnosticsEventLogPackageVersion>
<SystemDirectoryServicesPackageVersion>11.0.0-rc.1.26405.103</SystemDirectoryServicesPackageVersion>
<SystemDrawingCommonPackageVersion>11.0.0-rc.1.26405.103</SystemDrawingCommonPackageVersion>
<SystemFormatsNrbfPackageVersion>11.0.0-rc.1.26405.103</SystemFormatsNrbfPackageVersion>
<SystemIOPackagingPackageVersion>11.0.0-rc.1.26405.103</SystemIOPackagingPackageVersion>
<SystemPrivateWindowsCoreTestUtilitiesPackageVersion>11.0.0-rc.1.26405.103</SystemPrivateWindowsCoreTestUtilitiesPackageVersion>
<SystemReflectionMetadataLoadContextPackageVersion>11.0.0-rc.1.26405.103</SystemReflectionMetadataLoadContextPackageVersion>
<SystemResourcesExtensionsPackageVersion>11.0.0-rc.1.26405.103</SystemResourcesExtensionsPackageVersion>
<SystemRuntimeSerializationFormattersPackageVersion>11.0.0-rc.1.26405.103</SystemRuntimeSerializationFormattersPackageVersion>
<SystemSecurityCryptographyXmlPackageVersion>11.0.0-rc.1.26405.103</SystemSecurityCryptographyXmlPackageVersion>
<SystemSecurityPermissionsPackageVersion>11.0.0-rc.1.26405.103</SystemSecurityPermissionsPackageVersion>
<SystemWindowsExtensionsPackageVersion>11.0.0-rc.1.26405.103</SystemWindowsExtensionsPackageVersion>
<!-- dotnet-wpf-int dependencies -->
<MicrosoftDotNetWpfDncEngPackageVersion>11.0.0-preview.2.26270.1</MicrosoftDotNetWpfDncEngPackageVersion>
</PropertyGroup>
Expand Down
86 changes: 43 additions & 43 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="wpf" Sha="322f5005d6589845edf1d69d55820a7d1ab9a09c" BarId="325363" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="wpf" Sha="ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90" BarId="325824" />
<ProductDependencies>
<Dependency Name="Microsoft.Private.Winforms" Version="11.0.0-rc.1.26402.102">
<Dependency Name="Microsoft.Private.Winforms" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="11.0.0-rc.1.26402.102">
<Dependency Name="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Reflection.MetadataLoadContext" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Reflection.MetadataLoadContext" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Windows.Extensions" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Windows.Extensions" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Wpf.DncEng" Version="11.0.0-preview.2.26270.1">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int</Uri>
<Sha>a6da41e859712fcb3f2e5ed3474bdf86b4e5046a</Sha>
</Dependency>
<Dependency Name="System.Resources.Extensions" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Resources.Extensions" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Runtime.Serialization.Formatters" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Runtime.Serialization.Formatters" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-rc.1.26402.102">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.CodeDom" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.CodeDom" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Configuration.ConfigurationManager" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Configuration.ConfigurationManager" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Diagnostics.EventLog" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Diagnostics.EventLog" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.DirectoryServices" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.DirectoryServices" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Formats.Nrbf" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Formats.Nrbf" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.IO.Packaging" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.IO.Packaging" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Security.Cryptography.Xml" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Security.Cryptography.Xml" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Security.Permissions" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Security.Permissions" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="System.Drawing.Common" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Drawing.Common" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.Build.Framework" Version="15.9.20">
<Uri>https://github.com/dotnet/dotnet</Uri>
Expand All @@ -80,21 +80,21 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26402.102">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="11.0.0-beta.26402.102">
<Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="11.0.0-beta.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="11.0.0-beta.26402.102">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="11.0.0-beta.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.GenAPI" Version="11.0.0-beta.26402.102">
<Dependency Name="Microsoft.DotNet.GenAPI" Version="11.0.0-beta.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
<!-- TODO: Unpin sourcelink dependencies: https://github.com/dotnet/wpf/issues/11042 -->
<Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0-beta.23409.2" Pinned="true">
Expand All @@ -105,9 +105,9 @@
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>e9f665e52848a3615736c099e5631af531b66a5c</Sha>
</Dependency>
<Dependency Name="System.Private.Windows.Core.TestUtilities" Version="11.0.0-rc.1.26402.102">
<Dependency Name="System.Private.Windows.Core.TestUtilities" Version="11.0.0-rc.1.26405.103">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>322f5005d6589845edf1d69d55820a7d1ab9a09c</Sha>
<Sha>ae1c2e796871b41b1ffc4357e4aec0dd8c1f4f90</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
139 changes: 139 additions & 0 deletions eng/common/Get-GitHubAppToken.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Mints a short-lived GitHub App installation access token by signing a JWT
# with a private key stored in Azure Key Vault (RSA, RS256). The signed JWT is
# exchanged with the GitHub API for a token scoped to a single installation.
#
# Requirements:
# - A GitHub App whose private key has been uploaded into Key Vault as an RSA
# key (the PEM converted to a Key Vault *key*, NOT stored as a secret).
# - The caller (the federated Azure service connection used to run this script)
# must have the `Key Vault Crypto User` role (or at minimum the `Sign`
# action) on that key.
# - The App must be installed on the target organization/account
# (`InstallationOwner`) with the permissions/repositories it needs.
#
# Installation tokens (ghs_*) are exempt from the enterprise classic-PAT
# lifetime policy, which is why this replaces the long-lived PAT.

[CmdletBinding()]
param(
# Name of the Key Vault that holds the GitHub App's RSA signing key.
[Parameter(Mandatory = $true)]
[string] $KeyVaultName,

# Name of the RSA key inside the Key Vault (the App's private key).
[Parameter(Mandatory = $true)]
[string] $KeyName,

# The GitHub App's Client ID (the value to put in the `iss` JWT claim).
[Parameter(Mandatory = $true)]
[string] $AppClientId,

# Login of the organization or user account whose installation we should
# mint the token for (e.g. `dotnet`, `microsoft`).
[Parameter(Mandatory = $true)]
[string] $InstallationOwner,

# Optional Azure DevOps pipeline variable name to set with the installation
# token (marked as a secret). When not specified, the token is written to
# stdout instead.
[Parameter(Mandatory = $false)]
[string] $OutputVariableName
)

$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

. $PSScriptRoot\pipeline-logging-functions.ps1

function ConvertTo-Base64Url([byte[]] $bytes) {
return [Convert]::ToBase64String($bytes).TrimEnd('=').Replace('+', '-').Replace('/', '_')
}

# Build JWT header and payload. Use [ordered] hashtables so JSON
# serialization is deterministic.
$jwtHeader = [ordered]@{
alg = 'RS256'
typ = 'JWT'
}
$now = [System.DateTimeOffset]::UtcNow
$jwtPayload = [ordered]@{
iat = $now.AddMinutes(-1).ToUnixTimeSeconds()
exp = $now.AddMinutes(5).ToUnixTimeSeconds()
iss = $AppClientId
}

$headerEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtHeader | ConvertTo-Json -Compress)))
$payloadEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtPayload | ConvertTo-Json -Compress)))
$signingInput = "$headerEncoded.$payloadEncoded"

# Key Vault `sign` expects the *digest* (base64), not the raw bytes.
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$digestBytes = $sha256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($signingInput))
$digestBase64 = [Convert]::ToBase64String($digestBytes)

Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..."
try {
$signResponseJson = az keyvault key sign `
--vault-name $KeyVaultName `
--name $KeyName `
--algorithm RS256 `
--digest $digestBase64
}
catch {
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the JWT via Key Vault (key '$KeyName', vault '$KeyVaultName'): $_. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key."
exit 1
}
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($signResponseJson)) {
Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $LASTEXITCODE for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key."
exit 1
}
$signResponse = $signResponseJson | ConvertFrom-Json
if ([string]::IsNullOrEmpty($signResponse.signature)) {
Write-PipelineTelemetryError -Category 'Build' -Message "Key Vault returned an empty signature for key '$KeyName' in vault '$KeyVaultName'."
exit 1
}
$signatureUrl = $signResponse.signature.TrimEnd('=').Replace('+', '-').Replace('/', '_')
$jwt = "$signingInput.$signatureUrl"

$headers = @{
Authorization = "Bearer $jwt"
'X-GitHub-Api-Version' = '2022-11-28'
Accept = 'application/vnd.github+json'
'User-Agent' = 'dotnet-arcade-onelocbuild'
}

Write-Host "Looking up installation for '$InstallationOwner'..."
try {
$installations = Invoke-RestMethod -Uri 'https://api.github.com/app/installations' -Headers $headers -Method Get
}
catch {
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to list GitHub App installations: $_. The signed JWT may be invalid or the App's Client ID ('$AppClientId') may be incorrect."
exit 1
}
$installation = $installations | Where-Object { $_.account.login -eq $InstallationOwner } | Select-Object -First 1
if (-not $installation) {
$found = ($installations | ForEach-Object { $_.account.login }) -join ', '
Write-PipelineTelemetryError -Category 'Build' -Message "No installation found for '$InstallationOwner'. App is installed on: $found"
exit 1
}

try {
$tokenResponse = Invoke-RestMethod `
-Uri "https://api.github.com/app/installations/$($installation.id)/access_tokens" `
-Headers $headers `
-Method Post `
-ContentType 'application/json'
}
catch {
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to mint an installation access token for '$InstallationOwner' (installation $($installation.id)): $_"
exit 1
}

Write-Host "Got installation token for '$InstallationOwner' (expires $($tokenResponse.expires_at))."
if ($OutputVariableName) {
Write-Host "Setting pipeline variable '$OutputVariableName'."
Write-Host "##vso[task.setvariable variable=$OutputVariableName;issecret=true]$($tokenResponse.token)"
}
else {
Write-Host $tokenResponse.token -ForegroundColor Green
}
Loading