Skip to content

Commit 39f535f

Browse files
committed
Only show ratio of PR checks when some are failing
Now the possible outputs are: - "checks: pending" (yellow) - "checks: success" (green) - "checks: failing" (red) - 1 out of 1 check failed - "checks: 3/5 failing" (red) - 3 out of 5 checks failed
1 parent f58b7ec commit 39f535f

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

command/pr.go

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -361,29 +361,20 @@ func printPrs(prs ...api.PullRequest) {
361361
fmt.Printf("\n ")
362362
}
363363

364-
if checks.Total > 1 {
365-
var ratio string
364+
if checks.Total > 0 {
365+
var summary string
366366
if checks.Failing > 0 {
367-
ratio = fmt.Sprintf("%d/%d", checks.Passing, checks.Total)
368-
ratio = utils.Red(ratio)
367+
if checks.Total > 1 {
368+
summary = utils.Red(fmt.Sprintf("%d/%d failing", checks.Failing, checks.Total))
369+
} else {
370+
summary = utils.Red("failing")
371+
}
369372
} else if checks.Pending > 0 {
370-
ratio = fmt.Sprintf("%d/%d", checks.Passing, checks.Total)
371-
ratio = utils.Yellow(ratio)
373+
summary = utils.Yellow("pending")
372374
} else if checks.Passing == checks.Total {
373-
ratio = fmt.Sprintf("%d", checks.Total)
374-
ratio = utils.Green(ratio)
375+
summary = utils.Green("success")
375376
}
376-
fmt.Printf(" - checks: %s", ratio)
377-
} else if checks.Total == 1 {
378-
var state string
379-
if checks.Failing > 0 {
380-
state = utils.Red("failing")
381-
} else if checks.Pending > 0 {
382-
state = utils.Yellow("pending")
383-
} else if checks.Passing == checks.Total {
384-
state = utils.Green("success")
385-
}
386-
fmt.Printf(" - checks: %s", state)
377+
fmt.Printf(" - checks: %s", summary)
387378
}
388379

389380
if reviews.ChangesRequested {

0 commit comments

Comments
 (0)