feat(cmd): user prePage to check changelog dev (#2340)

pull/2367/head
180909 2 years ago committed by GitHub
parent 18c5734930
commit 0f0c75e20b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/kratos/internal/change/get.go

@ -59,9 +59,10 @@ func (g *GithubAPI) GetReleaseInfo(version string) ReleaseInfo {
func (g *GithubAPI) GetCommitsInfo() []CommitInfo { func (g *GithubAPI) GetCommitsInfo() []CommitInfo {
info := g.GetReleaseInfo("latest") info := g.GetReleaseInfo("latest")
page := 1 page := 1
prePage := 100
var list []CommitInfo var list []CommitInfo
for { for {
url := fmt.Sprintf("https://api.github.com/repos/%s/%s/commits?pre_page=100&page=%d&since=%s", g.Owner, g.Repo, page, info.PublishedAt) url := fmt.Sprintf("https://api.github.com/repos/%s/%s/commits?pre_page=%d&page=%d&since=%s", g.Owner, g.Repo, prePage, page, info.PublishedAt)
resp, code := requestGithubAPI(url, "GET", nil, g.Token) resp, code := requestGithubAPI(url, "GET", nil, g.Token)
if code != http.StatusOK { if code != http.StatusOK {
printGithubErrorInfo(resp) printGithubErrorInfo(resp)
@ -72,7 +73,7 @@ func (g *GithubAPI) GetCommitsInfo() []CommitInfo {
fatal(err) fatal(err)
} }
list = append(list, res...) list = append(list, res...)
if len(res) < http.StatusContinue { if len(res) < prePage {
break break
} }
page++ page++

Loading…
Cancel
Save