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

Function extractFirstFailingStepOutput

pkg/cli/audit.go:1017–1033  ·  view source on GitHub ↗
(opts auditJobRunOptions, jobLogContent string)

Source from the content-addressed store, hash-verified

1015}
1016
1017func extractFirstFailingStepOutput(opts auditJobRunOptions, jobLogContent string) error {
1018 failingStepNum, failingStepOutput := findFirstFailingStep(jobLogContent)
1019 if failingStepNum == 0 {
1020 if opts.verbose {
1021 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No failing steps found in job"))
1022 }
1023 return nil
1024 }
1025 stepLogPath := filepath.Join(opts.outputDir, fmt.Sprintf("job-%d-step-%d-failed.log", opts.jobID, failingStepNum))
1026 if err := os.WriteFile(stepLogPath, []byte(failingStepOutput), constants.FilePermSensitive); err != nil {
1027 return fmt.Errorf("failed to write failing step log: %w", err)
1028 }
1029 if opts.verbose {
1030 fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("First failing step %d output saved to %s", failingStepNum, stepLogPath)))
1031 }
1032 return nil
1033}
1034
1035func renderAuditJobSummary(opts auditJobRunOptions, jobLogPath string) {
1036 if opts.jsonOutput {

Callers 1

extractAuditJobDetailsFunction · 0.85

Calls 4

FormatInfoMessageFunction · 0.92
FormatSuccessMessageFunction · 0.92
findFirstFailingStepFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected