-
Notifications
You must be signed in to change notification settings - Fork 366
Refresh GitHub App installation token before pushing to azure-sdk-for-net #10737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0f5fcbd
6d666ba
46d28bb
3e636ee
32061c1
c233721
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -689,6 +689,24 @@ try { | |
| throw "Failed to commit changes" | ||
| } | ||
|
|
||
| $loginScript = Join-Path $PSScriptRoot "../../../../eng/common/scripts/login-to-github.ps1" | ||
| if (Test-Path $loginScript) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot it looks like this is failing in CI on regeneration:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — root cause is that Fixed in 32061c1 by switching the script's task in |
||
| Write-Host "Refreshing GitHub App installation token before push..." | ||
| try { | ||
| & $loginScript -InstallationTokenOwners 'Azure' -VariableNamePrefix 'GH_TOKEN' | ||
| if ($LASTEXITCODE -eq 0 -and (Test-Path Env:GH_TOKEN)) { | ||
| $AuthToken = $env:GH_TOKEN | ||
|
jorgerangel-msft marked this conversation as resolved.
|
||
| Write-Host "GitHub App installation token refreshed." | ||
| } else { | ||
| Write-Warning "login-to-github.ps1 did not produce a fresh token (exit code $LASTEXITCODE); falling back to existing token." | ||
| } | ||
| } catch { | ||
| Write-Warning "Failed to refresh GitHub App installation token: $($_.Exception.Message). Falling back to existing token." | ||
| } | ||
| } else { | ||
| Write-Host "login-to-github.ps1 not found at $loginScript; skipping token refresh (assuming a non-pipeline run with a long-lived token)." | ||
| } | ||
|
|
||
| # Push the branch. Use the x-access-token username scheme so the URL works | ||
| # both with classic PATs and with GitHub App installation tokens (ghs_*). | ||
| Write-Host "Pushing branch to remote..." | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.