Skip to content

Commit

Permalink
Merge pull request #11 from rsese/rsese-8-no-ghes-timing
Browse files Browse the repository at this point in the history
no workflow usage API on ghes
  • Loading branch information
rsese authored May 7, 2023
2 parents ee6d797 + 8b52e4d commit 0944d83
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -433,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")
Expand Down

0 comments on commit 0944d83

Please sign in to comment.