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

Function getLog

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

Source from the content-addressed store, hash-verified

470}
471
472func getLog(httpClient *http.Client, logURL safeurl.SafeURL) (io.ReadCloser, error) {
473 // TODO(api-client-rollout)
474 // 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.
475 req, err := http.NewRequest("GET", logURL.String(), nil)
476 if err != nil {
477 return nil, err
478 }
479
480 resp, err := httpClient.Do(req)
481 if err != nil {
482 return nil, err
483 }
484
485 if resp.StatusCode == 404 {
486 return nil, errors.New("log not found")
487 } else if resp.StatusCode != 200 {
488 return nil, api.HandleHTTPError(resp)
489 }
490
491 return resp.Body, nil
492}
493
494func getRunLog(cache RunLogCache, httpClient *http.Client, repo ghrepo.Interface, run *shared.Run, attempt uint64) (*zip.ReadCloser, error) {
495 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