X Tutup
Skip to content

Commit eabcae8

Browse files
authored
Merge pull request cli#81 from github/pr-status-single-check
`pr status`: avoid printing a lonely "1" when there is only one Check
2 parents adfc014 + 26c1e4a commit eabcae8

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

command/pr.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,18 +342,19 @@ func printPrs(prs ...api.PullRequest) {
342342
}
343343

344344
if checks.Total > 0 {
345-
var ratio string
345+
var summary string
346346
if checks.Failing > 0 {
347-
ratio = fmt.Sprintf("%d/%d", checks.Passing, checks.Total)
348-
ratio = utils.Red(ratio)
347+
if checks.Failing == checks.Total {
348+
summary = utils.Red("All checks failing")
349+
} else {
350+
summary = utils.Red(fmt.Sprintf("%d/%d checks failing", checks.Failing, checks.Total))
351+
}
349352
} else if checks.Pending > 0 {
350-
ratio = fmt.Sprintf("%d/%d", checks.Passing, checks.Total)
351-
ratio = utils.Yellow(ratio)
353+
summary = utils.Yellow("Checks pending")
352354
} else if checks.Passing == checks.Total {
353-
ratio = fmt.Sprintf("%d", checks.Total)
354-
ratio = utils.Green(ratio)
355+
summary = utils.Green("Checks passing")
355356
}
356-
fmt.Printf(" - checks: %s", ratio)
357+
fmt.Printf(" - %s", summary)
357358
}
358359

359360
if reviews.ChangesRequested {

0 commit comments

Comments
 (0)
X Tutup