MCPcopy
hub / github.com/cli/cli / GetRun

Function GetRun

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

Source from the content-addressed store, hash-verified

537}
538
539func GetRun(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64) (*Run, error) {
540 var result Run
541
542 path := fmt.Sprintf("repos/%s/actions/runs/%s?exclude_pull_requests=true", ghrepo.FullName(repo), runID)
543
544 if attempt > 0 {
545 path = fmt.Sprintf("repos/%s/actions/runs/%s/attempts/%d?exclude_pull_requests=true", ghrepo.FullName(repo), runID, attempt)
546 }
547
548 err := client.REST(repo.RepoHost(), "GET", path, nil, &result)
549 if err != nil {
550 return nil, err
551 }
552
553 if attempt > 0 {
554 result.URL, err = url.JoinPath(result.URL, fmt.Sprintf("/attempts/%d", attempt))
555 if err != nil {
556 return nil, err
557 }
558 }
559
560 // Set name to workflow name
561 workflow, err := workflowShared.GetWorkflow(client, repo, result.WorkflowID)
562 if err != nil {
563 return nil, err
564 } else {
565 result.workflowName = workflow.Name
566 }
567
568 return &result, nil
569}
570
571type colorFunc func(string) string
572

Callers 6

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

Calls 3

FullNameFunction · 0.92
RESTMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected