Skip to content

Commit 9f7124c

Browse files
Fix ListPullRequestsWithCommit option type (#2822)
Fixes: #2815.
1 parent 7a8ab98 commit 9f7124c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

github/pulls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin
170170
// By default, the PullRequestListOptions State filters for "open".
171171
//
172172
// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit
173-
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
173+
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*PullRequest, *Response, error) {
174174
u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha)
175175
u, err := addOptions(u, opts)
176176
if err != nil {

github/pulls_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,12 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) {
6969
testMethod(t, r, "GET")
7070
testHeader(t, r, "Accept", mediaTypeListPullsOrBranchesForCommitPreview)
7171
testFormValues(t, r, values{
72-
"state": "closed",
73-
"head": "h",
74-
"base": "b",
75-
"sort": "created",
76-
"direction": "desc",
77-
"page": "2",
72+
"page": "2",
7873
})
7974
fmt.Fprint(w, `[{"number":1}]`)
8075
})
8176

82-
opts := &PullRequestListOptions{"closed", "h", "b", "created", "desc", ListOptions{Page: 2}}
77+
opts := &ListOptions{Page: 2}
8378
ctx := context.Background()
8479
pulls, _, err := client.PullRequests.ListPullRequestsWithCommit(ctx, "o", "r", "sha", opts)
8580
if err != nil {

0 commit comments

Comments
 (0)