Skip to content

Fix Submit-AzureSdkForNetPr.ps1 push auth for GitHub App installation tokens#10710

Open
JoshLove-msft wants to merge 1 commit into
microsoft:mainfrom
JoshLove-msft:joshlove-msft/use-x-access-token-for-azure-sdk-pr-push
Open

Fix Submit-AzureSdkForNetPr.ps1 push auth for GitHub App installation tokens#10710
JoshLove-msft wants to merge 1 commit into
microsoft:mainfrom
JoshLove-msft:joshlove-msft/use-x-access-token-for-azure-sdk-pr-push

Conversation

@JoshLove-msft
Copy link
Copy Markdown
Contributor

Why

#10594 transitioned the publish pipeline from a static PAT (azuresdk-github-pat) to a GitHub App installation token minted via eng/common/scripts/login-to-github.ps1. The token is then passed into Submit-AzureSdkForNetPr.ps1 as -AuthToken '$(GH_TOKEN)'.

The script builds the push URL like this:

$remoteUrl = "https://$AuthToken@github.com/$RepoOwner/$RepoName.git"
git push $remoteUrl $PRBranch

That bare-token form works with classic PATs (GitHub accepts username=PAT, empty password) but fails with GitHub App installation tokens (ghs_*). git treats the token as the username and prompts for a password, producing the failure observed in the latest pipeline run:

fatal: could not read Password for 'https://***@github.com': terminal prompts disabled

Fix

Use the x-access-token username scheme, which is the documented form that works for both classic PATs and GitHub App installation tokens:

$remoteUrl = "https://x-access-token:$AuthToken@github.com/$RepoOwner/$RepoName.git"

One-line change. No behavior difference for the previous PAT path.

…tokens

PR microsoft#10594 transitioned the publish pipeline from a static PAT (azuresdk-github-pat)
to a GitHub App installation token minted via login-to-github.ps1. Installation
tokens (ghs_*) cannot be used in the bare 'https://TOKEN@github.com/' form ΓÇö
git treats the token as the username and prompts for a password, producing:

  fatal: could not read Password for 'https://***@github.com': terminal prompts disabled

Switch the push URL to 'https://x-access-token:TOKEN@github.com/' which works
for both classic PATs and GitHub App installation tokens.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label May 16, 2026
@JoshLove-msft JoshLove-msft enabled auto-merge May 16, 2026 02:09
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@10710

commit: 3074d16

@github-actions
Copy link
Copy Markdown
Contributor

No changes needing a change description found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant