From c8ae44e4e12ce71b438e21f9b2fcfc0dee4043fb Mon Sep 17 00:00:00 2001 From: Robert Sese <734194+rsese@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:05:21 -0500 Subject: [PATCH 1/2] get repo html_url for display --- main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 7f37a43..f559b5f 100644 --- a/main.go +++ b/main.go @@ -144,6 +144,7 @@ func (w *workflow) RenderCard() string { } type repositoryData struct { + HtmlUrl string `json:"html_url"` Name string `json:"full_name"` Private bool Workflows []*workflow @@ -188,9 +189,7 @@ func noTerminalRender(repos []*repositoryData) error { } fmt.Println() fmt.Println(r.Name) - // TODO leverage go-gh to determine what host to use - // (NB: go-gh needs a PR in order to help with this) - fmt.Printf("https://github.com/%s/actions\n", r.Name) + fmt.Printf("%s/actions\n", r.HtmlUrl) fmt.Println() for _, w := range r.Workflows { @@ -233,9 +232,7 @@ func terminalRender(repos []*repositoryData) error { } fmt.Println() fmt.Print(repoNameStyle.Render(r.Name)) - // TODO leverage go-gh to determine what host to use - // (NB: go-gh needs a PR in order to help with this) - fmt.Print(repoHintStyle.Render(fmt.Sprintf(" https://github.com/%s/actions\n", r.Name))) + fmt.Print(repoHintStyle.Render(fmt.Sprintf(" %s/actions\n", r.HtmlUrl))) fmt.Println() totalRows := int(math.Ceil(float64(len(r.Workflows)) / float64(cardsPerRow))) From 8b52e4dc091e1f21acb9bbe3cfd4be50f7ec3134 Mon Sep 17 00:00:00 2001 From: Robert Sese <734194+rsese@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:05:45 -0500 Subject: [PATCH 2/2] actions timing API not available on GHES --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index f559b5f..443c0c7 100644 --- a/main.go +++ b/main.go @@ -430,7 +430,7 @@ func getWorkflows(repoData repositoryData, last time.Duration) ([]*workflow, err } } - if repoData.Private { + if repoData.Private && strings.Index(repoData.HtmlUrl, "https://github.com") == 0 { for _, r := range runs { runTimingPath := fmt.Sprintf("%s/timing", r.URL) stdout, _, err = gh.Exec("api", "--cache", defaultApiCacheTime, runTimingPath, "--jq", ".billable")