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

@iulia-biulia-b commented May 11, 2026

Copy link
Copy Markdown
Contributor

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-biulia-b changed the title upgrade to v 0.86[WIP] Upgrade go-github to v 0.86May 11, 2026
@iulia-b
iulia-bforce-pushed the iunia/update-go-github-version branch from 0c77296 to 2c243e2CompareMay 18, 2026 08:39
@iulia-biulia-b changed the title [WIP] Upgrade go-github to v 0.86[WIP] Upgrade go-github to v 0.87May 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 ownerMay 18, 2026 10:46
CopilotAI review requested due to automatic review settings May 18, 2026 10:46
@iulia-biulia-b changed the title [WIP] Upgrade go-github to v 0.87Upgrade go-github to v 0.87May 18, 2026
Comment threadpkg/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?

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
pkg/raw/raw.goUpdates raw client construction to new go-github client API and passes context.Context into NewRequest.
pkg/raw/raw_test.goUpdates tests for new go-github client constructor signature (options + error).
pkg/lockdown/lockdown.goUpdates go-github import to v87.
pkg/lockdown/lockdown_test.goUpdates test REST client creation to v87 constructor API.
pkg/github/tools.goUpdates go-github import to v87.
pkg/github/server_test.goAdjusts test client stubbing to v87 client creation patterns.
pkg/github/security_advisories.goUpdates go-github import to v87.
pkg/github/security_advisories_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/secret_scanning.goUpdates go-github import to v87.
pkg/github/secret_scanning_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/search.goUpdates go-github import to v87.
pkg/github/search_utils.goUpdates go-github import to v87.
pkg/github/search_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/repository_resource.goUpdates go-github import to v87.
pkg/github/repository_resource_test.goUpdates raw client construction (now error-returning) and uses mustNewGHClient.
pkg/github/repository_resource_completions.goUpdates go-github import to v87.
pkg/github/repository_resource_completions_test.goUpdates go-github import to v87.
pkg/github/repositories.goUpdates go-github import to v87.
pkg/github/repositories_test.goUpdates raw client creation (now error-returning) and uses mustNewGHClient.
pkg/github/repositories_helper.goUpdates go-github import to v87.
pkg/github/pullrequests.goUpdates go-github import to v87.
pkg/github/pullrequests_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/pullrequests_granular.goUpdates go-github import alias to v87.
pkg/github/projects.goUpdates v83+ projects pagination/query option shapes (pointer→value changes).
pkg/github/projects_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/params.goUpdates go-github import to v87.
pkg/github/params_test.goUpdates go-github import to v87.
pkg/github/notifications.goUpdates MarkThreadDone call to new signature (string thread ID).
pkg/github/notifications_test.goUpdates tests for MarkThreadDone signature and uses mustNewGHClient.
pkg/github/minimal_types.goUpdates go-github import to v87.
pkg/github/issues.goUpdates sub-issue listing options to use ListOptions (IssueListOptions removal).
pkg/github/issues_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/issues_granular.goUpdates low-level REST request creation/execution to new v86+ signatures (ctx in NewRequest, updated Do).
pkg/github/helper_test.goAdds mustNewGHClient helper for consistent v87 test client creation.
pkg/github/granular_tools_test.goMigrates granular tool tests to mustNewGHClient.
pkg/github/git.goUpdates go-github import to v87.
pkg/github/git_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/gists.goUpdates go-github import to v87.
pkg/github/gists_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/discussions.goUpdates go-github import to v87.
pkg/github/discussions_test.goUpdates go-github import to v87.
pkg/github/dependencies.goRefactors request-scoped REST/raw client creation to v87 NewClient(...options) and handles new raw client error return.
pkg/github/dependabot.goUpdates go-github import to v87.
pkg/github/dependabot_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/copilot.goUpdates go-github import to v87.
pkg/github/copilot_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/context_tools_test.goMigrates tests to mustNewGHClient and updates client stub helper signature.
pkg/github/code_scanning.goUpdates go-github import to v87.
pkg/github/code_scanning_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/github/actions.goAdapts workflow dispatch calls to new return value shape.
pkg/github/actions_test.goMigrates tests to mustNewGHClient for v87 client creation.
pkg/errors/error.goUpdates go-github import to v87.
pkg/errors/error_test.goUpdates go-github import to v87.
internal/ghmcp/server.goRefactors server-wide REST client creation to v87 NewClient(...options) and updates user-agent injection strategy.
go.modBumps github.com/google/go-github/v82v87.
go.sumUpdates checksums for the go-github/v87 dependency.
e2e/e2e_test.goUpdates 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 threade2e/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

@SamMorrowDrumsSamMorrowDrums left a comment

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.

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 🤯 🎉

// 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.

❤️

}

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
ContributorAuthor

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-bforce-pushed the iunia/update-go-github-version branch from 2c243e2 to e871c7bCompareMay 18, 2026 12:15
@JoannaaKL
JoannaaKL merged commit 1861a35 into github:mainMay 18, 2026
12 checks passed
Sign up for freeto 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

@iulia-b@JoannaaKL@SamMorrowDrums@pachecocordovamoiseseduardo-byte