Skip to content

Commit 77eb503

Browse files
Merge pull request #312 from drone/CODE-2023
fix query params for List PRs API call for stash provider for paginat…
2 parents fc4336b + 2e2589d commit 77eb503

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scm/driver/stash/pr.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (s *pullService) FindComment(ctx context.Context, repo string, number int,
3434

3535
func (s *pullService) List(ctx context.Context, repo string, opts scm.PullRequestListOptions) ([]*scm.PullRequest, *scm.Response, error) {
3636
namespace, name := scm.Split(repo)
37-
path := fmt.Sprintf("rest/api/1.0/projects/%s/repos/%s/pull-requests", namespace, name)
37+
path := fmt.Sprintf("rest/api/1.0/projects/%s/repos/%s/pull-requests?%s", namespace, name, encodePullRequestListOptions(opts))
3838
out := new(prs)
3939
res, err := s.client.do(ctx, "GET", path, nil, out)
4040
if !out.pagination.LastPage.Bool {

scm/driver/stash/util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func encodePullRequestListOptions(opts scm.PullRequestListOptions) string {
111111
if opts.Open && opts.Closed {
112112
params.Set("state", "all")
113113
} else if opts.Closed {
114-
params.Set("state", "closed")
114+
params.Set("state", "declined")
115115
}
116116
return params.Encode()
117117
}

0 commit comments

Comments
 (0)