Upgrade go-github to v 0.87 - #2452
Conversation
0c77296 to
2c243e2
Compare
|
|
||
| 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) |
There was a problem hiding this comment.
What is this newly omitted value?
There was a problem hiding this comment.
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-githubdependency tov87.0.0and 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
mustNewGHClienthelper and to reflect updatedgo-githubbehaviors.
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/v82 → v87. |
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
| "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
left a comment
There was a problem hiding this comment.
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) |
| 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) |
There was a problem hiding this comment.
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 { |
| } | ||
|
|
||
| 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 { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Should I add / is there a test for this ?
|
Hey @iulia-b can you please run |
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>
2c243e2 to
e871c7b
Compare
github-mcp-server 1.0.5 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Add ifc label for list_issues tool by @gokhanarkan in github/github-mcp-server#2453 * Add ifc label for get_file_contents tool by @gokhanarkan in github/github-mcp-server#2454 * Add missing pagination on get_reviews by @RossTarrant in github/github-mcp-server#2367 * Add optional `rationale` parameter to `update_issue_type` tool by @alondahari in github/github-mcp-server#2458 * Add ifc label for search_issues tool by @gokhanarkan in github/github-mcp-server#2456 * Add ifc label for issue_read tool by @gokhanarkan in github/github-mcp-server#2457 * Add ifc label for search_repositories tool by @gokhanarkan in github/github-mcp-server#2459 * Return minimal code search results with text match snippets by @SamMorrowDrums in github/github-mcp-server#2476 * Replace ingress IFC reader list with private marker by @gokhanarkan in github/github-mcp-server#2478 * Document Copilot Spaces PAT requirements by @Bestra in github/github-mcp-server#2479 * Add tool to list repo collaborators by @JoannaaKL in github/github-mcp-server#2477 * Add tool for discussion comment write operations by @RossTarrant in github/github-mcp-server#2427 * Upgrade go-github to v 0.87 by @iulia-b in github/github-mcp-server#2452 ## New Contributors * @alondahari made their first contribution in github/github-mcp-server#2458 * @Bestra made their first contribution in github/github-mcp-server#2479 **Full Changelog**: https://github.com/github/github-mcp-server/compare/v1.0.4...v1.0.5</pre> <p>View the full release notes at <a href="https://github.com/github/github-mcp-server/releases/tag/v1.0.5">https://github.com/github/github-mcp-server/releases/tag/v1.0.5</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!3094
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
strconv import
removed unused queryPtr variable
MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goNote: 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
./script/lint./script/testDocs