Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

When updating a PR branch with no conflicts, use GitHub's native updatePullRequestBranch GraphQL mutation instead of manually orchestrating tree/commit creation via REST.

Changes

  • GraphQL schema (queries.gql, queriesExtra.gql): Added UpdatePullRequestBranch mutation
  • Types (graphql.ts): Added UpdatePullRequestBranchResponse interface
  • Branch update logic (pullRequestModel.ts):
    • Route Mergeable/Behind states through new updateBranchWithGraphQL()
    • Preserve REST approach for Conflict state (requires manual resolution)
    • Unknown/NotMergeable states fall back to REST as defensive behavior

Before/After

Before: 5 REST calls (getBranch → getCommit → createTree → createCommit → updateRef)

After: 1 GraphQL mutation for clean updates

await mutate<UpdatePullRequestBranchResponse>({
  mutation: schema.UpdatePullRequestBranch,
  variables: {
    input: {
      pullRequestId: this.graphNodeId,
      expectedHeadOid: this.head.sha
    }
  }
});

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.20.0/x64/bin/node node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Use the GH GraphQL API UpdatePullRequestBranch for pulling in updates when there are no conflicts</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 23, 2026 17:36
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Use GH GraphQL API to update pull request branch Use GraphQL UpdatePullRequestBranch mutation for conflict-free branch updates Jan 23, 2026
Copilot AI requested a review from alexr00 January 23, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the GH GraphQL API UpdatePullRequestBranch for pulling in updates when there are no conflicts

2 participants