feat: add attemptLabel to RenderRunHeader
This commit is contained in:
parent
343e730016
commit
baaa5c3184
1 changed files with 9 additions and 2 deletions
|
|
@ -7,14 +7,21 @@ import (
|
|||
"github.com/cli/cli/v2/pkg/iostreams"
|
||||
)
|
||||
|
||||
func RenderRunHeader(cs *iostreams.ColorScheme, run Run, ago, prNumber string) string {
|
||||
func RenderRunHeader(cs *iostreams.ColorScheme, run Run, ago, prNumber string, attempt uint64) string {
|
||||
title := fmt.Sprintf("%s %s%s",
|
||||
cs.Bold(run.HeadBranch), run.WorkflowName(), prNumber)
|
||||
symbol, symbolColor := Symbol(cs, run.Status, run.Conclusion)
|
||||
id := cs.Cyanf("%d", run.ID)
|
||||
|
||||
var attemptLabel string
|
||||
if attempt == 0 {
|
||||
attemptLabel = "Latest Attempt"
|
||||
} else {
|
||||
attemptLabel = fmt.Sprintf("Attempt #%d", attempt)
|
||||
}
|
||||
|
||||
header := ""
|
||||
header += fmt.Sprintf("%s %s · %s\n", symbolColor(symbol), title, id)
|
||||
header += fmt.Sprintf("%s %s · %s (%s)\n", symbolColor(symbol), title, id, attemptLabel)
|
||||
header += fmt.Sprintf("Triggered via %s %s", run.Event, ago)
|
||||
|
||||
return header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue