Skip to content

Commit

Permalink
feat: update GetRun path based on attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Mar 26, 2023
1 parent bd0f535 commit 9a0f791
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/cmd/run/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,15 @@ func PromptForRun(cs *iostreams.ColorScheme, runs []Run) (string, error) {
return fmt.Sprintf("%d", runs[selected].ID), nil
}

func GetRun(client *api.Client, repo ghrepo.Interface, runID string) (*Run, error) {
func GetRun(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64) (*Run, error) {
var result Run
var path string

path := fmt.Sprintf("repos/%s/actions/runs/%s?exclude_pull_requests=true", ghrepo.FullName(repo), runID)
if attempt == 0 {
path = fmt.Sprintf("repos/%s/actions/runs/%s?exclude_pull_requests=true", ghrepo.FullName(repo), runID)
} else {
path = fmt.Sprintf("repos/%s/actions/runs/%s/attempts/%d?exclude_pull_requests=true", ghrepo.FullName(repo), runID, attempt)
}

err := client.REST(repo.RepoHost(), "GET", path, nil, &result)
if err != nil {
Expand Down

0 comments on commit 9a0f791

Please sign in to comment.