Update to go-github v87#92
Open
SamMorrowDrums wants to merge 3 commits into
Open
Conversation
Bumps the go-github dependency from v73 to v87 (latest) and
regenerates endpoint patterns from the latest GitHub OpenAPI
description.
Breaking changes in go-github v87 required minor source updates:
* github.NewClient now uses a functional-options pattern and returns
(*Client, error). All NewClient(httpClient) call sites switch to
NewClient(github.WithHTTPClient(httpClient)). README and doc
examples updated to match.
* Git.UpdateRef now takes a ref string plus a github.UpdateRef value
(instead of *Reference + force bool). The TestUpdateGitReference
test is updated accordingly.
While regenerating, the var-name generator produced names containing
literal '}' characters for paths with hyphenated parameters such as
'{enterprise-team}' (new in v87). FormatToGolangVarName now splits
the path by '/' before processing and treats '-' and '_' as word
separators inside both path segments and parameter names, so
'/enterprises/{enterprise}/teams/{enterprise-team}/memberships' now
generates 'GetEnterprisesTeamsMembershipsByEnterpriseByEnterpriseTeam'.
Regression tests cover the hyphenated and mutated-parameter cases.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
|
Thanks for the PR @SamMorrowDrums . I'll review it tonight. |
Replace the inline `c, _ := github.NewClient(github.WithHTTPClient(...))` pattern in the test suite with a `MustNewGHClient(t, httpClient)` helper that fails the test if client construction returns an error, instead of silently discarding it. Mirrors the `mustNewGHClient` helper used in github/github-mcp-server after its own go-github options-pattern transition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Bumps
github.com/google/go-githubfrom v73 → v87 (latest) and regenerates the endpoint patterns from the current GitHub OpenAPI description.go-github v87 breaking changes that affect this repo
github.NewClientnow uses a functional-options pattern and returns(*Client, error). Allgithub.NewClient(httpClient)call sites switch togithub.NewClient(github.WithHTTPClient(httpClient)).main.go, all tests, the doc comment onNewMockedHTTPClient, and the README examples are updated.Git.UpdateRefnow takes aref stringplus agithub.UpdateRefvalue (was*Reference + force bool).TestUpdateGitReferenceis updated.The other v87 breaking changes (
GetConsumedLicenses→ListConsumedLicenses,GetAllRepositoryRulesets→ListAllRepositoryRulesets,GetRulesForBranch→ListRulesForBranch,IssueRequest.IssueFieldValuesshape) are go-github method renames and don't affect this repo, since endpoint patterns are derived from URL paths, not method names.Generator fix for hyphenated path parameters
While regenerating,
FormatToGolangVarNameproduced names containing literal}characters for paths with hyphenated parameters (new in v87, e.g.{enterprise-team}). The old logic didstrings.ReplaceAll(pattern, "-", "/")across the whole URL, which split{enterprise-team}into the broken parts{enterpriseandteam}.The generator now:
/first.-and_as word separators inside both non-parameter segments and parameter names.So
/enterprises/{enterprise}/teams/{enterprise-team}/membershipsnow producesGetEnterprisesTeamsMembershipsByEnterpriseByEnterpriseTeam. Behaviour for existing patterns is unchanged. Regression tests cover the hyphenated-parameter and mutated-parameter ({path:.*}) cases.Generated diff
src/mock/endpointpattern.go: +1542 / −402 lines. New endpoints include the Copilot coding agent (/agents/*), enterprise Copilot metrics/policies, enterprise teams, the new attestations and campaigns APIs, expanded code-security configuration endpoints, secret-scanning push protection bypass, etc. Removals reflect endpoints retired between v73 and v87 of the spec.Verification
both pass locally on Go 1.26.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com