From 9f7124cc0903ad531ba469d2f1403fb3e39645cf Mon Sep 17 00:00:00 2001 From: nxya Date: Mon, 3 Jul 2023 09:25:52 -0400 Subject: [PATCH] Fix ListPullRequestsWithCommit option type (#2822) Fixes: #2815. --- github/pulls.go | 2 +- github/pulls_test.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/github/pulls.go b/github/pulls.go index 6e49eba2f91..533e86b5f0a 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -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 { diff --git a/github/pulls_test.go b/github/pulls_test.go index 590483fadb3..87f6f41cfb8 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -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 {