From 90083cd5c50c15d2612d593066461c42360b8833 Mon Sep 17 00:00:00 2001 From: nxya Date: Wed, 28 Jun 2023 16:10:51 -0400 Subject: [PATCH 1/2] replaced PullRequestListOptions param with ListOptions Co-Authored-By: vgnshiyer --- github/pulls.go | 2 +- github/pulls_test.go | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/github/pulls.go b/github/pulls.go index 6e49eba2f9..533e86b5f0 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 590483fadb..e8c52c8e06 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", }) 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 { From 2dd9f5cc63939c20c96b44a75b0f358cba309eb6 Mon Sep 17 00:00:00 2001 From: nxya Date: Wed, 28 Jun 2023 17:27:22 -0400 Subject: [PATCH 2/2] formatting pulls_test.go --- github/pulls_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/pulls_test.go b/github/pulls_test.go index e8c52c8e06..87f6f41cfb 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -69,7 +69,7 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeListPullsOrBranchesForCommitPreview) testFormValues(t, r, values{ - "page": "2", + "page": "2", }) fmt.Fprint(w, `[{"number":1}]`) })