| 537 | } |
| 538 | |
| 539 | func 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 | |
| 571 | type colorFunc func(string) string |
| 572 | |