Skip to content

Commit

Permalink
Fix ListPullRequestsWithCommit option type (#2822)
Browse files Browse the repository at this point in the history
Fixes: #2815.
  • Loading branch information
RickleAndMortimer committed Jul 3, 2023
1 parent 7a8ab98 commit 9f7124c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion github/pulls.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin
// By default, the PullRequestListOptions State filters for "open".
//
// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha)
u, err := addOptions(u, opts)
if err != nil {
Expand Down
9 changes: 2 additions & 7 deletions github/pulls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,12 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeListPullsOrBranchesForCommitPreview)
testFormValues(t, r, values{
"state": "closed",
"head": "h",
"base": "b",
"sort": "created",
"direction": "desc",
"page": "2",
"page": "2",
})
fmt.Fprint(w, `[{"number":1}]`)
})

opts := &PullRequestListOptions{"closed", "h", "b", "created", "desc", ListOptions{Page: 2}}
opts := &ListOptions{Page: 2}
ctx := context.Background()
pulls, _, err := client.PullRequests.ListPullRequestsWithCommit(ctx, "o", "r", "sha", opts)
if err != nil {
Expand Down

0 comments on commit 9f7124c

Please sign in to comment.