Skip to content

Commit 46d28bb

Browse files
address review: remove verbose comment, use Test-Path Env:GH_TOKEN
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/9410e129-7681-41bf-886a-3d9f44856866 Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
1 parent 6d666ba commit 46d28bb

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

packages/http-client-csharp/eng/scripts/Submit-AzureSdkForNetPr.ps1

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,12 @@ try {
689689
throw "Failed to commit changes"
690690
}
691691

692-
# Refresh the GitHub App installation token immediately before pushing.
693-
# Installation tokens are valid for only 1 hour; regenerating Azure data-plane
694-
# and/or mgmt SDK libraries above can exceed this window, causing the original
695-
# token to be expired by push time. login-to-github.ps1 mints a fresh
696-
# installation token via Azure Key Vault (az CLI auth from the prior
697-
# AzureCLI@2-based login-to-github.yml step persists across tasks in the same
698-
# job via ~/.azure). The refreshed token is exported as $env:GH_TOKEN, which
699-
# is also picked up by `gh pr create` below.
700692
$loginScript = Join-Path $PSScriptRoot "../../../../eng/common/scripts/login-to-github.ps1"
701693
if (Test-Path $loginScript) {
702694
Write-Host "Refreshing GitHub App installation token before push..."
703695
try {
704696
& $loginScript -InstallationTokenOwners @($RepoOwner)
705-
if ($LASTEXITCODE -eq 0 -and $env:GH_TOKEN) {
697+
if ($LASTEXITCODE -eq 0 -and (Test-Path Env:GH_TOKEN)) {
706698
$AuthToken = $env:GH_TOKEN
707699
Write-Host "GitHub App installation token refreshed."
708700
} else {

0 commit comments

Comments
 (0)