mirror of
https://gitea.com/jolheiser/sip
synced 2024-11-22 19:51:58 +01:00
894a641ef8
Clean up docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Add generated docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Update go.sum Signed-off-by: jolheiser <john.olheiser@gmail.com> Fix remote parsing Signed-off-by: jolheiser <john.olheiser@gmail.com> Refactor and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: jolheiser <john.olheiser@gmail.com> Reviewed-on: https://gitea.com/jolheiser/sip/pulls/29
26 lines
513 B
Go
26 lines
513 B
Go
package sdk
|
|
|
|
import (
|
|
"code.gitea.io/sdk/gitea"
|
|
)
|
|
|
|
// GetPulls returns all matching PRs from a Gitea instance
|
|
func GetPulls(client *gitea.Client, owner, repo string, opts gitea.ListPullRequestsOptions) ([]*gitea.PullRequest, error) {
|
|
pulls := make([]*gitea.PullRequest, 0)
|
|
p := 1
|
|
for {
|
|
opts.Page = p
|
|
list, _, err := client.ListRepoPullRequests(owner, repo, opts)
|
|
if err != nil {
|
|
return pulls, err
|
|
}
|
|
p++
|
|
pulls = append(pulls, list...)
|
|
|
|
if len(list) == 0 {
|
|
break
|
|
}
|
|
}
|
|
return pulls, nil
|
|
}
|