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

Function GetRun

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

Source from the content-addressed store, hash-verified

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

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