MCPcopy Create free account
hub / github.com/github/gh-aw / printChecksText

Function printChecksText

pkg/cli/checks_command.go:396–413  ·  view source on GitHub ↗

printChecksText prints the result in human-readable form to stderr.

(result *ChecksResult)

Source from the content-addressed store, hash-verified

394
395// printChecksText prints the result in human-readable form to stderr.
396func printChecksText(result *ChecksResult) error {
397 switch result.State {
398 case CheckStateSuccess:
399 fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("PR #%s: all checks passed (%d total)", result.PRNumber, result.TotalCount)))
400 case CheckStateFailed:
401 fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("PR #%s: checks failed (%d total)", result.PRNumber, result.TotalCount)))
402 case CheckStatePending:
403 fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("PR #%s: checks pending (%d total)", result.PRNumber, result.TotalCount)))
404 case CheckStateNoChecks:
405 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("PR #%s: no checks configured or triggered", result.PRNumber)))
406 case CheckStatePolicyBlocked:
407 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("PR #%s: blocked by policy or account gate (%d total)", result.PRNumber, result.TotalCount)))
408 }
409
410 // Always print the normalized state to stdout for machine consumption.
411 fmt.Fprintln(os.Stdout, string(result.State))
412 return nil
413}

Callers 2

RunChecksFunction · 0.85
TestPrintChecksTextFunction · 0.85

Calls 4

FormatSuccessMessageFunction · 0.92
FormatErrorMessageFunction · 0.92
FormatInfoMessageFunction · 0.92
FormatWarningMessageFunction · 0.92

Tested by 1

TestPrintChecksTextFunction · 0.68