Allow up to 100 CI checks for CI status command

I'm working on a project that has a complex CI setup, and reaches more
than 30. Sometimes `hub ci-status` would report success when it was
still pending, which was very annoying.

per_page=100 is used in many other queries, and is the maximum that is
allowed without paging.
This commit is contained in:
Robert (Jamie) Munro 2021-01-25 19:13:16 +00:00
Родитель c4af574b19
Коммит 63bdaa53b2
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -542,7 +542,7 @@ func (client *Client) FetchCIStatus(project *Project, sha string) (status *CISta
return
}
res, err := api.Get(fmt.Sprintf("repos/%s/%s/commits/%s/status", project.Owner, project.Name, sha))
res, err := api.Get(fmt.Sprintf("repos/%s/%s/commits/%s/status?per_page=100", project.Owner, project.Name, sha))
if err = checkStatus(200, "fetching statuses", res, err); err != nil {
return
}
@ -565,7 +565,7 @@ func (client *Client) FetchCIStatus(project *Project, sha string) (status *CISta
}
sortStatuses()
res, err = api.GetFile(fmt.Sprintf("repos/%s/%s/commits/%s/check-runs", project.Owner, project.Name, sha), checksType)
res, err = api.GetFile(fmt.Sprintf("repos/%s/%s/commits/%s/check-runs?per_page=100", project.Owner, project.Name, sha), checksType)
if err == nil && (res.StatusCode == 403 || res.StatusCode == 404 || res.StatusCode == 422) {
return
}