26 lines
600 B
Go
26 lines
600 B
Go
package services
|
|
|
|
import (
|
|
"context"
|
|
|
|
my_github "gitea.com/gitea/pr-deployer/pkgs/github"
|
|
"gitea.com/gitea/pr-deployer/pkgs/settings"
|
|
|
|
"github.com/google/go-github/v39/github"
|
|
"golang.org/x/oauth2"
|
|
)
|
|
|
|
func GetPullRequests(token *oauth2.Token, p int) ([]*github.PullRequest, error) {
|
|
c := my_github.GetGithubClient(token)
|
|
pulls, _, err := c.PullRequests.List(context.Background(), settings.RepoOwner, settings.RepoName, &github.PullRequestListOptions{
|
|
Sort: "updated",
|
|
Direction: "desc",
|
|
ListOptions: github.ListOptions{
|
|
Page: p,
|
|
PerPage: 50,
|
|
},
|
|
})
|
|
|
|
return pulls, err
|
|
}
|