Skip to content

Commit 4e06c00

Browse files
committed
fix casting in graphql calls
1 parent 14fee97 commit 4e06c00

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.25.7
44

55
require (
66
github.com/cli/go-gh/v2 v2.13.0
7+
github.com/cli/shurcooL-graphql v0.0.4
78
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
89
github.com/spf13/cobra v1.10.2
910
)
@@ -18,7 +19,6 @@ require (
1819
github.com/charmbracelet/x/term v0.2.1 // indirect
1920
github.com/cli/browser v1.3.0 // indirect
2021
github.com/cli/safeexec v1.0.0 // indirect
21-
github.com/cli/shurcooL-graphql v0.0.4 // indirect
2222
github.com/davecgh/go-spew v1.1.1 // indirect
2323
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
2424
github.com/henvic/httpretty v0.0.6 // indirect

internal/github/github.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strings"
77

88
"github.com/cli/go-gh/v2/pkg/api"
9+
graphql "github.com/cli/shurcooL-graphql"
910
)
1011

1112
// PullRequest represents a GitHub pull request.
@@ -68,9 +69,9 @@ func (c *Client) FindPRForBranch(branch string) (*PullRequest, error) {
6869
}
6970

7071
variables := map[string]interface{}{
71-
"owner": c.owner,
72-
"name": c.repo,
73-
"head": branch,
72+
"owner": graphql.String(c.owner),
73+
"name": graphql.String(c.repo),
74+
"head": graphql.String(branch),
7475
}
7576

7677
if err := c.gql.Query("FindPRForBranch", &query, variables); err != nil {
@@ -113,9 +114,9 @@ func (c *Client) GetPR(number int) (*PullRequest, error) {
113114
}
114115

115116
variables := map[string]interface{}{
116-
"owner": c.owner,
117-
"name": c.repo,
118-
"number": number,
117+
"owner": graphql.String(c.owner),
118+
"name": graphql.String(c.repo),
119+
"number": graphql.Int(number),
119120
}
120121

121122
if err := c.gql.Query("GetPR", &query, variables); err != nil {
@@ -314,7 +315,7 @@ func (c *Client) FindStackPRs(startPR *PullRequest) ([]*PullRequest, string, err
314315

315316
func (c *Client) fetchOpenPRs() ([]*PullRequest, error) {
316317
var prs []*PullRequest
317-
var cursor *string
318+
var cursor *graphql.String
318319

319320
for {
320321
var query struct {
@@ -339,8 +340,8 @@ func (c *Client) fetchOpenPRs() ([]*PullRequest, error) {
339340
}
340341

341342
variables := map[string]interface{}{
342-
"owner": c.owner,
343-
"name": c.repo,
343+
"owner": graphql.String(c.owner),
344+
"name": graphql.String(c.repo),
344345
"cursor": cursor,
345346
}
346347

@@ -364,7 +365,7 @@ func (c *Client) fetchOpenPRs() ([]*PullRequest, error) {
364365
if !query.Repository.PullRequests.PageInfo.HasNextPage {
365366
break
366367
}
367-
endCursor := query.Repository.PullRequests.PageInfo.EndCursor
368+
endCursor := graphql.String(query.Repository.PullRequests.PageInfo.EndCursor)
368369
cursor = &endCursor
369370
}
370371

@@ -392,8 +393,8 @@ func (c *Client) repositoryID() (string, error) {
392393
}
393394

394395
variables := map[string]interface{}{
395-
"owner": c.owner,
396-
"name": c.repo,
396+
"owner": graphql.String(c.owner),
397+
"name": graphql.String(c.repo),
397398
}
398399

399400
if err := c.gql.Query("RepositoryID", &query, variables); err != nil {

0 commit comments

Comments
 (0)