MCPcopy Create free account
hub / github.com/cli/cli / getLog

Function getLog

pkg/cmd/run/view/view.go:473–493  ·  view source on GitHub ↗
(httpClient *http.Client, logURL safeurl.SafeURL)

Source from the content-addressed store, hash-verified

471}
472
473func getLog(httpClient *http.Client, logURL safeurl.SafeURL) (io.ReadCloser, error) {
474 // TODO(api-client-rollout)
475 // This has been deferred from moving to api.Client due to streaming the run log ZIP response body for archive processing instead of decoding JSON.
476 req, err := http.NewRequest("GET", logURL.String(), nil)
477 if err != nil {
478 return nil, err
479 }
480
481 resp, err := httpClient.Do(req)
482 if err != nil {
483 return nil, err
484 }
485
486 if resp.StatusCode == 404 {
487 return nil, errors.New("log not found")
488 } else if resp.StatusCode != 200 {
489 return nil, api.HandleHTTPError(resp)
490 }
491
492 return resp.Body, nil
493}
494
495func getRunLog(cache RunLogCache, httpClient *http.Client, repo ghrepo.Interface, run *shared.Run, attempt uint64) (*zip.ReadCloser, error) {
496 cacheKey := fmt.Sprintf("%d-%d", run.ID, run.StartedTime().Unix())

Callers 1

getRunLogFunction · 0.85

Calls 3

HandleHTTPErrorFunction · 0.92
StringMethod · 0.65
DoMethod · 0.65

Tested by

no test coverage detected