Skip to content

Commit 3bbb430

Browse files
authored
Bump go-github for search_type support
1 parent eb088df commit 3bbb430

7 files changed

Lines changed: 47 additions & 49 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25.12
55
require (
66
github.com/go-chi/chi/v5 v5.3.1
77
github.com/go-viper/mapstructure/v2 v2.5.0
8-
github.com/google/go-github/v89 v89.0.0
8+
github.com/google/go-github/v89 v89.0.1-0.20260728185857-34349a88bac3
99
github.com/google/jsonschema-go v0.4.3
1010
github.com/josephburnett/jd/v2 v2.5.0
1111
github.com/lithammer/fuzzysearch v1.1.8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArs
1616
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1717
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
1818
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
19-
github.com/google/go-github/v89 v89.0.0 h1:35bEK5XoEcF3PZrlVbl9XN63f5BcJRA/UGkxeC9xPg0=
20-
github.com/google/go-github/v89 v89.0.0/go.mod h1:QLcbU0ipeAqQuR5KSg8c2lql4Qk1EwJ2dWz/0rP4Nho=
19+
github.com/google/go-github/v89 v89.0.1-0.20260728185857-34349a88bac3 h1:0a/p9KtPso8UBauBD/p9Go1oaZrrEydBNHjaaKkSHJo=
20+
github.com/google/go-github/v89 v89.0.1-0.20260728185857-34349a88bac3/go.mod h1:QLcbU0ipeAqQuR5KSg8c2lql4Qk1EwJ2dWz/0rP4Nho=
2121
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
2222
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
2323
github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0=

pkg/github/issues.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,11 +2382,11 @@ func CreateIssue(ctx context.Context, client *github.Client, owner string, repo
23822382
}
23832383

23842384
// Create the issue request
2385-
issueRequest := &github.IssueRequest{
2386-
Title: github.Ptr(title),
2385+
issueRequest := github.CreateIssueRequest{
2386+
Title: title,
23872387
Body: github.Ptr(body),
2388-
Assignees: &assignees,
2389-
Labels: &labels,
2388+
Assignees: assignees,
2389+
Labels: labels,
23902390
IssueFieldValues: issueFieldValues,
23912391
}
23922392

@@ -2449,7 +2449,7 @@ func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4
24492449
}
24502450

24512451
// Create the issue request with only provided fields
2452-
issueRequest := &github.IssueRequest{}
2452+
issueRequest := github.UpdateIssueRequest{}
24532453

24542454
// Set optional parameters if provided
24552455
if title != "" {
@@ -2461,11 +2461,11 @@ func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4
24612461
}
24622462

24632463
if updateOptions.LabelsProvided {
2464-
issueRequest.Labels = &labels
2464+
issueRequest.Labels = labels
24652465
}
24662466

24672467
if updateOptions.AssigneesProvided {
2468-
issueRequest.Assignees = &assignees
2468+
issueRequest.Assignees = assignees
24692469
}
24702470

24712471
if milestoneNum != 0 {
@@ -2519,7 +2519,7 @@ func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4
25192519
}
25202520
}
25212521

2522-
updatedIssue, resp, err := client.Issues.Edit(ctx, owner, repo, issueNumber, issueRequest)
2522+
updatedIssue, resp, err := client.Issues.Update(ctx, owner, repo, issueNumber, issueRequest)
25232523
if err != nil {
25242524
return ghErrors.NewGitHubAPIErrorResponse(ctx,
25252525
"failed to update issue",

pkg/github/issues_delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
func Test_IssueRequest_EmptyFieldValues_OmittedByJSON(t *testing.T) {
2424
t.Parallel()
2525

26-
req := &gogithub.IssueRequest{
26+
req := &gogithub.UpdateIssueRequest{
2727
Title: gogithub.Ptr("still here"),
2828
IssueFieldValues: []*gogithub.IssueRequestFieldValue{},
2929
}

pkg/github/issues_granular.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func issueUpdateTool(
2929
name, description, title string,
3030
extraProps map[string]*jsonschema.Schema,
3131
extraRequired []string,
32-
buildRequest func(args map[string]any) (*github.IssueRequest, error),
32+
buildRequest func(args map[string]any) (github.UpdateIssueRequest, error),
3333
) inventory.ServerTool {
3434
props := map[string]*jsonschema.Schema{
3535
"owner": {
@@ -92,7 +92,7 @@ func issueUpdateTool(
9292
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil
9393
}
9494

95-
issue, resp, err := client.Issues.Edit(ctx, owner, repo, issueNumber, issueReq)
95+
issue, resp, err := client.Issues.Update(ctx, owner, repo, issueNumber, issueReq)
9696
if err != nil {
9797
return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to update issue", resp, err), nil, nil
9898
}
@@ -164,8 +164,8 @@ func GranularCreateIssue(t translations.TranslationHelperFunc) inventory.ServerT
164164
}
165165
body, _ := OptionalParam[string](args, "body")
166166

167-
issueReq := &github.IssueRequest{
168-
Title: &title,
167+
issueReq := github.CreateIssueRequest{
168+
Title: title,
169169
}
170170
if body != "" {
171171
issueReq.Body = &body
@@ -206,12 +206,12 @@ func GranularUpdateIssueTitle(t translations.TranslationHelperFunc) inventory.Se
206206
"title": {Type: "string", Description: "The new title for the issue"},
207207
},
208208
[]string{"title"},
209-
func(args map[string]any) (*github.IssueRequest, error) {
209+
func(args map[string]any) (github.UpdateIssueRequest, error) {
210210
title, err := RequiredParam[string](args, "title")
211211
if err != nil {
212-
return nil, err
212+
return github.UpdateIssueRequest{}, err
213213
}
214-
return &github.IssueRequest{Title: &title}, nil
214+
return github.UpdateIssueRequest{Title: &title}, nil
215215
},
216216
)
217217
}
@@ -226,12 +226,12 @@ func GranularUpdateIssueBody(t translations.TranslationHelperFunc) inventory.Ser
226226
"body": {Type: "string", Description: "The new body content for the issue"},
227227
},
228228
[]string{"body"},
229-
func(args map[string]any) (*github.IssueRequest, error) {
229+
func(args map[string]any) (github.UpdateIssueRequest, error) {
230230
body, err := RequiredParam[string](args, "body")
231231
if err != nil {
232-
return nil, err
232+
return github.UpdateIssueRequest{}, err
233233
}
234-
return &github.IssueRequest{Body: &body}, nil
234+
return github.UpdateIssueRequest{Body: &body}, nil
235235
},
236236
)
237237
}
@@ -392,7 +392,7 @@ func GranularUpdateIssueAssignees(t translations.TranslationHelperFunc) inventor
392392
for i, p := range payload {
393393
logins[i] = p.(string)
394394
}
395-
body = &github.IssueRequest{Assignees: &logins}
395+
body = &github.UpdateIssueRequest{Assignees: logins}
396396
}
397397

398398
apiURL := fmt.Sprintf("repos/%s/%s/issues/%d", owner, repo, issueNumber)
@@ -610,7 +610,7 @@ func GranularUpdateIssueLabels(t translations.TranslationHelperFunc) inventory.S
610610
for i, p := range payload {
611611
names[i] = p.(string)
612612
}
613-
body = &github.IssueRequest{Labels: &names}
613+
body = &github.UpdateIssueRequest{Labels: names}
614614
}
615615

616616
apiURL := fmt.Sprintf("repos/%s/%s/issues/%d", owner, repo, issueNumber)
@@ -654,12 +654,12 @@ func GranularUpdateIssueMilestone(t translations.TranslationHelperFunc) inventor
654654
},
655655
},
656656
[]string{"milestone"},
657-
func(args map[string]any) (*github.IssueRequest, error) {
657+
func(args map[string]any) (github.UpdateIssueRequest, error) {
658658
milestone, err := RequiredInt(args, "milestone")
659659
if err != nil {
660-
return nil, err
660+
return github.UpdateIssueRequest{}, err
661661
}
662-
return &github.IssueRequest{Milestone: &milestone}, nil
662+
return github.UpdateIssueRequest{Milestone: &milestone}, nil
663663
},
664664
)
665665
}
@@ -787,7 +787,7 @@ func GranularUpdateIssueType(t translations.TranslationHelperFunc) inventory.Ser
787787
},
788788
}
789789
} else {
790-
body = &github.IssueRequest{Type: &issueType}
790+
body = &github.UpdateIssueRequest{Type: &issueType}
791791
}
792792

793793
apiURL := fmt.Sprintf("repos/%s/%s/issues/%d", owner, repo, issueNumber)
@@ -981,7 +981,7 @@ func GranularUpdateIssueState(t translations.TranslationHelperFunc) inventory.Se
981981
}
982982
body = req
983983
} else {
984-
req := &github.IssueRequest{State: &state}
984+
req := &github.UpdateIssueRequest{State: &state}
985985
if stateReason != "" {
986986
req.StateReason = &stateReason
987987
}

pkg/github/issues_test.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ func Test_CreateIssue(t *testing.T) {
14491449
State: github.Ptr("open"),
14501450
HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
14511451
Assignees: []*github.User{{Login: github.Ptr("user1")}, {Login: github.Ptr("user2")}},
1452-
Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("help wanted")}},
1452+
Labels: []*github.Label{{Name: "bug"}, {Name: "help wanted"}},
14531453
Milestone: &github.Milestone{Number: github.Ptr(5)},
14541454
Type: &github.IssueType{Name: github.Ptr("Bug")},
14551455
}
@@ -1520,10 +1520,8 @@ func Test_CreateIssue(t *testing.T) {
15201520
name: "successful issue creation with issue fields reconciled by names",
15211521
mockedClient: MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
15221522
PostReposIssuesByOwnerByRepo: expectRequestBody(t, map[string]any{
1523-
"title": "Issue with fields",
1524-
"body": "",
1525-
"labels": []any{},
1526-
"assignees": []any{},
1523+
"title": "Issue with fields",
1524+
"body": "",
15271525
"issue_field_values": []any{
15281526
map[string]any{"field_id": float64(101), "value": "P1"},
15291527
map[string]any{"field_id": float64(102), "value": "Acme"},
@@ -2851,7 +2849,7 @@ func Test_UpdateIssue(t *testing.T) {
28512849
State: github.Ptr("open"),
28522850
HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
28532851
Assignees: []*github.User{{Login: github.Ptr("assignee1")}, {Login: github.Ptr("assignee2")}},
2854-
Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("priority")}},
2852+
Labels: []*github.Label{{Name: "bug"}, {Name: "priority"}},
28552853
Milestone: &github.Milestone{Number: github.Ptr(5)},
28562854
Type: &github.IssueType{Name: github.Ptr("Bug")},
28572855
}
@@ -2864,7 +2862,7 @@ func Test_UpdateIssue(t *testing.T) {
28642862
StateReason: github.Ptr("duplicate"),
28652863
HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
28662864
Assignees: []*github.User{{Login: github.Ptr("assignee1")}, {Login: github.Ptr("assignee2")}},
2867-
Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("priority")}},
2865+
Labels: []*github.Label{{Name: "bug"}, {Name: "priority"}},
28682866
Milestone: &github.Milestone{Number: github.Ptr(5)},
28692867
Type: &github.IssueType{Name: github.Ptr("Bug")},
28702868
}
@@ -3265,7 +3263,7 @@ func Test_UpdateIssue(t *testing.T) {
32653263
Number: github.Ptr(123),
32663264
Title: github.Ptr("Updated Title"),
32673265
Body: github.Ptr("Updated Description"),
3268-
Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("priority")}},
3266+
Labels: []*github.Label{{Name: "bug"}, {Name: "priority"}},
32693267
Assignees: []*github.User{{Login: github.Ptr("assignee1")}, {Login: github.Ptr("assignee2")}},
32703268
Milestone: &github.Milestone{Number: github.Ptr(5)},
32713269
Type: &github.IssueType{Name: github.Ptr("Bug")},
@@ -3970,8 +3968,8 @@ func Test_AddSubIssue(t *testing.T) {
39703968
},
39713969
Labels: []*github.Label{
39723970
{
3973-
Name: github.Ptr("enhancement"),
3974-
Color: github.Ptr("84b6eb"),
3971+
Name: "enhancement",
3972+
Color: "84b6eb",
39753973
Description: github.Ptr("New feature or request"),
39763974
},
39773975
},
@@ -4195,8 +4193,8 @@ func Test_GetSubIssues(t *testing.T) {
41954193
},
41964194
Labels: []*github.Label{
41974195
{
4198-
Name: github.Ptr("bug"),
4199-
Color: github.Ptr("d73a4a"),
4196+
Name: "bug",
4197+
Color: "d73a4a",
42004198
Description: github.Ptr("Something isn't working"),
42014199
},
42024200
},
@@ -4684,8 +4682,8 @@ func Test_RemoveSubIssue(t *testing.T) {
46844682
},
46854683
Labels: []*github.Label{
46864684
{
4687-
Name: github.Ptr("enhancement"),
4688-
Color: github.Ptr("84b6eb"),
4685+
Name: "enhancement",
4686+
Color: "84b6eb",
46894687
Description: github.Ptr("New feature or request"),
46904688
},
46914689
},
@@ -4892,8 +4890,8 @@ func Test_ReprioritizeSubIssue(t *testing.T) {
48924890
},
48934891
Labels: []*github.Label{
48944892
{
4895-
Name: github.Ptr("enhancement"),
4896-
Color: github.Ptr("84b6eb"),
4893+
Name: "enhancement",
4894+
Color: "84b6eb",
48974895
Description: github.Ptr("New feature or request"),
48984896
},
48994897
},

pkg/github/pullrequests.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,10 @@ func CreatePullRequest(t translations.TranslationHelperFunc) inventory.ServerToo
777777
return utils.NewToolResultError(err.Error()), nil, nil
778778
}
779779

780-
newPR := &github.NewPullRequest{
780+
newPR := &github.CreatePullRequest{
781781
Title: github.Ptr(title),
782-
Head: github.Ptr(head),
783-
Base: github.Ptr(base),
782+
Head: head,
783+
Base: base,
784784
}
785785

786786
if body != "" {
@@ -794,7 +794,7 @@ func CreatePullRequest(t translations.TranslationHelperFunc) inventory.ServerToo
794794
if err != nil {
795795
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil
796796
}
797-
pr, resp, err := client.PullRequests.Create(ctx, owner, repo, newPR)
797+
pr, resp, err := client.PullRequests.Create(ctx, owner, repo, *newPR)
798798
if err != nil {
799799
return ghErrors.NewGitHubAPIErrorResponse(ctx,
800800
"failed to create pull request",

0 commit comments

Comments
 (0)