(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64)
| 557 | } |
| 558 | |
| 559 | func 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 | |
| 598 | type colorFunc func(string) string |
| 599 |
no test coverage detected