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

Function GetRun

pkg/cmd/run/shared/shared.go:559–596  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64)

Source from the content-addressed store, hash-verified

557}
558
559func GetRun(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64) (*Run, error) {
560 var result Run
561
562 u, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs", runID)
563 if err != nil {
564 return nil, err
565 }
566
567 if attempt > 0 {
568 u, err = safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs", runID, "attempts", strconv.FormatUint(attempt, 10))
569 if err != nil {
570 return nil, err
571 }
572 }
573 u.SetQuery("exclude_pull_requests", "true")
574
575 err = client.REST(repo.RepoHost(), "GET", u.String(), nil, &result)
576 if err != nil {
577 return nil, err
578 }
579
580 if attempt > 0 {
581 result.URL, err = url.JoinPath(result.URL, fmt.Sprintf("/attempts/%d", attempt))
582 if err != nil {
583 return nil, err
584 }
585 }
586
587 // Set name to workflow name
588 workflow, err := workflowShared.GetWorkflow(client, repo, result.WorkflowID)
589 if err != nil {
590 return nil, err
591 } else {
592 result.workflowName = workflow.Name
593 }
594
595 return &result, nil
596}
597
598type colorFunc func(string) string
599

Callers 6

runRerunFunction · 0.92
runDeleteFunction · 0.92
runViewFunction · 0.92
watchRunFunction · 0.92
renderRunFunction · 0.92
runCancelFunction · 0.92

Calls 7

JoinPathFunction · 0.92
SetQueryMethod · 0.80
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected