Fix bug only list first page when get prs from gitea #41

Merged
lunny merged 1 commits from lunny/changelog:lunny/fix_list_pr into master 2020-03-29 01:56:26 +00:00
5 changed files with 12 additions and 7 deletions

View File

@ -26,7 +26,6 @@ var (
)
func runGenerate(cmd *cli.Context) error {
if ConfigPathFlag == "" {
ConfigPathFlag = getDefaultConfigFile()
}

View File

@ -30,7 +30,7 @@ type Config struct {
SkipRegex *regexp.Regexp `yaml:"-"`
}
// Load a config from a path, defaulting to changelog.example.yml
// New Load a config from a path, defaulting to changelog.example.yml
Review

New loads a config ...

New loads a config ...
func New(configPath string) (*Config, error) {
var err error
var configContent []byte

2
go.mod
View File

@ -3,7 +3,7 @@ module code.gitea.io/changelog
go 1.13
require (
code.gitea.io/sdk/gitea v0.0.0-20200131051706-c1cfc890f875
code.gitea.io/sdk/gitea v0.11.1-0.20200209183134-ba7916819f3f
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect

4
go.sum
View File

@ -1,5 +1,5 @@
code.gitea.io/sdk/gitea v0.0.0-20200131051706-c1cfc890f875 h1:Rw4BbCwc0L4JwJko1b/k9fBuVG0NQEnGupuDZx4n+WE=
code.gitea.io/sdk/gitea v0.0.0-20200131051706-c1cfc890f875/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY=
code.gitea.io/sdk/gitea v0.11.1-0.20200209183134-ba7916819f3f h1:Ezc1cu8bksy+eqCA0fuvkPdppqCzfJIbNQ/8ipeBV3k=
code.gitea.io/sdk/gitea v0.11.1-0.20200209183134-ba7916819f3f/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=

View File

@ -40,7 +40,10 @@ func (ge *Gitea) Generate() (string, []PullRequest, error) {
perPage := 40
for {
results, err := client.ListRepoPullRequests(ge.Owner, ge.Repo, gitea.ListPullRequestsOptions{
Page: p,
ListOptions: gitea.ListOptions{
Page: p,
PageSize: perPage,
},
State: "closed",
Milestone: milestoneID,
})
@ -91,7 +94,10 @@ func (ge *Gitea) Contributors() (ContributorList, error) {
perPage := 100
for {
results, err := client.ListRepoPullRequests(ge.Owner, ge.Repo, gitea.ListPullRequestsOptions{
Page: p,
ListOptions: gitea.ListOptions{
Page: p,
PageSize: perPage,
},
State: "closed",
Milestone: milestoneID,
})