Fix PR creation on GitHub App auth path (pass --head to gh pr create)#1445
Open
jingjingjia-ms wants to merge 1 commit into
Open
Fix PR creation on GitHub App auth path (pass --head to gh pr create)#1445jingjingjia-ms wants to merge 1 commit into
jingjingjia-ms wants to merge 1 commit into
Conversation
The GitHub App auth generation path clones repos with `git clone --depth 1`, which implies --single-branch and only tracks the base branch. After pushing the generated feature branch, no `refs/remotes/origin/<branch>` tracking ref exists locally, so `gh pr create` (which auto-detects the pushed head via that ref) aborts with "you must first push the current branch to a remote, or use the --head flag" even though the push succeeded. - create-pull-request.ps1: pass `-H $env:BranchName` and `-R $env:RepoName` to `gh pr create`, and fail the step on a non-zero exit code instead of always printing "Pull Request Created successfully." - language-generation-kiota.yml: thread `BranchName` into the create-pull-request.ps1 step env so the head branch is available. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Build 225234 failed on all 6
microsoft/Agents-M365Copilotgeneration jobs at the Create Pull Request step with:The push actually succeeded — the branches (
ccs-{dotnet,python,typescript}/{v1.0,beta}/pipelinebuild/225234) exist on the remote, each ahead ofmainwith the generated commit — but no PRs were created, and the log misleadingly printed "Pull Request Created successfully."Root cause
The GitHub App auth path (
useGitHubAppAuth: true, used only by Agents-M365Copilot) clones withgit clone --depth 1.--depth 1implies--single-branch, soremote.origin.fetchonly tracks the base branch. After pushing the generated feature branch, norefs/remotes/origin/<branch>tracking ref exists locally.gh pr create(invoked without--head) detects the pushed head via that tracking ref, doesn't find it, and aborts — even though the branch is on the remote. The other SDK repos use the ADOcheckout:task, which wires up full tracking refs, so they were unaffected.Fix
scripts/create-pull-request.ps1: pass-H $env:BranchName(bypasses the tracking-ref auto-detection) and-R $env:RepoNametogh pr create; fail the step on a non-zero exit code instead of unconditionally printing success.language-generation-kiota.yml: threadBranchNameinto thecreate-pull-request.ps1stepenv:so the head branch is available (shared step — both auth paths get the more robust--head/-Rinvocation).Microsoft Reviewers: Open in CodeFlow