Skip to content

Upgrade go-github to v 0.87#2452

Merged
JoannaaKL merged 1 commit into
github:mainfrom
iulia-b:iunia/update-go-github-version
May 18, 2026
Merged

Upgrade go-github to v 0.87#2452
JoannaaKL merged 1 commit into
github:mainfrom
iulia-b:iunia/update-go-github-version

Conversation

@iulia-b
Copy link
Copy Markdown
Contributor

@iulia-b iulia-b commented May 11, 2026

Summary

Update google/go-github from v82 to v87, fixing all breaking API changes across the four major versions.

Why

Keeping dependencies up to date for bug fixes, security patches, and new API support. v83–v87 include security improvements (cross-host redirect
rejection, URL path traversal protection, webhook payload size limits) and new GitHub API coverage,as well as support for reading and writing issue field values by using the rest api

What changed

  • Updated google/go-github from v82 to v86 across all Go files and go.mod
  • pkg/raw/raw.go: Pass context.Context to NewRequest (v86 refactor), remove redundant WithContext
  • pkg/github/actions.go: Handle new *WorkflowDispatchRunDetails return value from CreateWorkflowDispatchEventByID/ByFileName (v84)
  • pkg/github/issues.go: Replace removed IssueListOptions with ListOptions for SubIssue.ListByIssue (v84)
  • pkg/github/notifications.go: MarkThreadDone now takes string instead of int64 (v85) — removed unnecessary strconv.ParseInt conversion and unused
    strconv import
  • pkg/github/notifications_test.go: Removed invalid threadID format test case (no longer applicable)
  • pkg/github/projects.go: ListProjectsPaginationOptions fields changed from pointers to values (v83) — updated Query, After, Before, PerPage usage;
    removed unused queryPtr variable
  • e2e/e2e_test.go: Removed nil opts arg from ListReviewers call (v83)

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

@iulia-b iulia-b changed the title upgrade to v 0.86 [WIP] Upgrade go-github to v 0.86 May 11, 2026
@iulia-b iulia-b force-pushed the iunia/update-go-github-version branch from 0c77296 to 2c243e2 Compare May 18, 2026 08:39
@iulia-b iulia-b changed the title [WIP] Upgrade go-github to v 0.86 [WIP] Upgrade go-github to v 0.87 May 18, 2026
@iulia-b iulia-b marked this pull request as ready for review May 18, 2026 10:46
@iulia-b iulia-b requested a review from a team as a code owner May 18, 2026 10:46
Copilot AI review requested due to automatic review settings May 18, 2026 10:46
@iulia-b iulia-b changed the title [WIP] Upgrade go-github to v 0.87 Upgrade go-github to v 0.87 May 18, 2026
Comment thread pkg/github/actions.go

if workflowIDInt, parseErr := strconv.ParseInt(workflowID, 10, 64); parseErr == nil {
resp, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, owner, repo, workflowIDInt, event)
_, resp, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, owner, repo, workflowIDInt, event)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this newly omitted value?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades github.com/google/go-github from v82 to v87 across the MCP server, updating client construction and adapting to breaking API changes introduced in v83–v87.

Changes:

  • Bumped go-github dependency to v87.0.0 and updated imports throughout the codebase.
  • Refactored REST client creation to the new github.NewClient(...options) API and updated request/response call sites for changed method signatures.
  • Updated/adjusted unit tests to use a shared mustNewGHClient helper and to reflect updated go-github behaviors.
Show a summary per file
File Description
pkg/raw/raw.go Updates raw client construction to new go-github client API and passes context.Context into NewRequest.
pkg/raw/raw_test.go Updates tests for new go-github client constructor signature (options + error).
pkg/lockdown/lockdown.go Updates go-github import to v87.
pkg/lockdown/lockdown_test.go Updates test REST client creation to v87 constructor API.
pkg/github/tools.go Updates go-github import to v87.
pkg/github/server_test.go Adjusts test client stubbing to v87 client creation patterns.
pkg/github/security_advisories.go Updates go-github import to v87.
pkg/github/security_advisories_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/secret_scanning.go Updates go-github import to v87.
pkg/github/secret_scanning_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/search.go Updates go-github import to v87.
pkg/github/search_utils.go Updates go-github import to v87.
pkg/github/search_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/repository_resource.go Updates go-github import to v87.
pkg/github/repository_resource_test.go Updates raw client construction (now error-returning) and uses mustNewGHClient.
pkg/github/repository_resource_completions.go Updates go-github import to v87.
pkg/github/repository_resource_completions_test.go Updates go-github import to v87.
pkg/github/repositories.go Updates go-github import to v87.
pkg/github/repositories_test.go Updates raw client creation (now error-returning) and uses mustNewGHClient.
pkg/github/repositories_helper.go Updates go-github import to v87.
pkg/github/pullrequests.go Updates go-github import to v87.
pkg/github/pullrequests_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/pullrequests_granular.go Updates go-github import alias to v87.
pkg/github/projects.go Updates v83+ projects pagination/query option shapes (pointer→value changes).
pkg/github/projects_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/params.go Updates go-github import to v87.
pkg/github/params_test.go Updates go-github import to v87.
pkg/github/notifications.go Updates MarkThreadDone call to new signature (string thread ID).
pkg/github/notifications_test.go Updates tests for MarkThreadDone signature and uses mustNewGHClient.
pkg/github/minimal_types.go Updates go-github import to v87.
pkg/github/issues.go Updates sub-issue listing options to use ListOptions (IssueListOptions removal).
pkg/github/issues_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/issues_granular.go Updates low-level REST request creation/execution to new v86+ signatures (ctx in NewRequest, updated Do).
pkg/github/helper_test.go Adds mustNewGHClient helper for consistent v87 test client creation.
pkg/github/granular_tools_test.go Migrates granular tool tests to mustNewGHClient.
pkg/github/git.go Updates go-github import to v87.
pkg/github/git_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/gists.go Updates go-github import to v87.
pkg/github/gists_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/discussions.go Updates go-github import to v87.
pkg/github/discussions_test.go Updates go-github import to v87.
pkg/github/dependencies.go Refactors request-scoped REST/raw client creation to v87 NewClient(...options) and handles new raw client error return.
pkg/github/dependabot.go Updates go-github import to v87.
pkg/github/dependabot_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/copilot.go Updates go-github import to v87.
pkg/github/copilot_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/context_tools_test.go Migrates tests to mustNewGHClient and updates client stub helper signature.
pkg/github/code_scanning.go Updates go-github import to v87.
pkg/github/code_scanning_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/github/actions.go Adapts workflow dispatch calls to new return value shape.
pkg/github/actions_test.go Migrates tests to mustNewGHClient for v87 client creation.
pkg/errors/error.go Updates go-github import to v87.
pkg/errors/error_test.go Updates go-github import to v87.
internal/ghmcp/server.go Refactors server-wide REST client creation to v87 NewClient(...options) and updates user-agent injection strategy.
go.mod Bumps github.com/google/go-github/v82v87.
go.sum Updates checksums for the go-github/v87 dependency.
e2e/e2e_test.go Updates go-github import to v87 (but e2e client creation code still needs migration to v87 API).

Copilot's findings

  • Files reviewed: 56/57 changed files
  • Comments generated: 1

Comment thread e2e/e2e_test.go
Comment on lines 18 to 24
"github.com/github/github-mcp-server/internal/ghmcp"
"github.com/github/github-mcp-server/pkg/github"
"github.com/github/github-mcp-server/pkg/translations"
gogithub "github.com/google/go-github/v82/github"
gogithub "github.com/google/go-github/v87/github"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/stretchr/testify/require"
)
SamMorrowDrums
SamMorrowDrums previously approved these changes May 18, 2026
Copy link
Copy Markdown
Collaborator

@SamMorrowDrums SamMorrowDrums left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, this is thorough work, and it will need a companion PR to remote server, but that's OK I'll tag my team to decide on who wants to take this.

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
client := github.NewClient(tc.mockedClient)
client := mustNewGHClient(t, tc.mockedClient)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

return utils.NewToolResultError(fmt.Sprintf("invalid threadID format: %v", err)), nil, nil
}
resp, err = client.Activity.MarkThreadDone(ctx, threadIDInt)
resp, err = client.Activity.MarkThreadDone(ctx, threadID)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this finally fixed 🤯 🎉

Comment thread pkg/github/helper_test.go
// mustNewGHClient creates a new GitHub client for testing.
// If httpClient is nil, a client with no options is created.
// The test fails immediately if client creation fails.
func mustNewGHClient(t *testing.T, httpClient *http.Client) *gogithub.Client {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Comment thread internal/ghmcp/server.go
}

func addUserAgentsMiddleware(cfg github.MCPServerConfig, restClient *gogithub.Client, gqlHTTPClient *http.Client) func(next mcp.MethodHandler) mcp.MethodHandler {
func addUserAgentsMiddleware(cfg github.MCPServerConfig, restUATransp *transport.UserAgentTransport, gqlHTTPClient *http.Client) func(next mcp.MethodHandler) mcp.MethodHandler {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to be sure (I didn't re-check where it's passed from), that the transport is always created per request for http endpoint and is not going to be concurrently mutated or anything by parallel requests)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add / is there a test for this ?

@JoannaaKL
Copy link
Copy Markdown
Collaborator

Hey @iulia-b can you please run ./script/license to generate licenses? :)

Breaking changes addressed:
- raw.NewClient: Use WithHTTPClient/WithEnterpriseURLs options, pass ctx to
  NewRequest, return (*Client, error)
- internal/ghmcp/server.go: Use functional options for REST client creation,
  replace UserAgent field mutation with UserAgentTransport wrapper, add
  restUATransp field to githubClients struct
- pkg/github/dependencies.go: Use functional options for REST client creation,
  handle raw.NewClient error return
- pkg/github/actions.go: Handle new WorkflowDispatchRunDetails return value
  from CreateWorkflowDispatchEventByID/ByFileName
- pkg/github/issues.go: Replace IssueListOptions with ListOptions for
  SubIssue.ListByIssue
- pkg/github/notifications.go: MarkThreadDone now takes string instead of
  int64; remove ParseInt and strconv import
- pkg/github/projects.go: Remove pointer indirection from
  ListProjectsPaginationOptions and ListProjectsOptions fields
- pkg/github/issues_granular.go: Pass ctx to NewRequest, remove ctx from Do
- Test files: Add mustNewGHClient helper, replace all NewClient calls,
  fix stubClientFnFromHTTP signature, fix lockdown_test.go BaseURL handling,
  fix raw_test.go, remove invalid threadID test case

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iulia-b iulia-b force-pushed the iunia/update-go-github-version branch from 2c243e2 to e871c7b Compare May 18, 2026 12:15
@JoannaaKL JoannaaKL merged commit 1861a35 into github:main May 18, 2026
12 checks passed
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.

5 participants