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

Function extractRequestedStepOutput

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

Source from the content-addressed store, hash-verified

997}
998
999func extractRequestedStepOutput(opts auditJobRunOptions, jobLogContent string) error {
1000 stepOutput, err := extractStepOutput(jobLogContent, opts.stepNumber)
1001 if err != nil {
1002 if opts.verbose {
1003 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Could not extract step %d output: %v", opts.stepNumber, err)))
1004 }
1005 return nil
1006 }
1007 stepLogPath := filepath.Join(opts.outputDir, fmt.Sprintf("job-%d-step-%d.log", opts.jobID, opts.stepNumber))
1008 if err := os.WriteFile(stepLogPath, []byte(stepOutput), constants.FilePermSensitive); err != nil {
1009 return fmt.Errorf("failed to write step log: %w", err)
1010 }
1011 if opts.verbose {
1012 fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Step %d output saved to %s", opts.stepNumber, stepLogPath)))
1013 }
1014 return nil
1015}
1016
1017func extractFirstFailingStepOutput(opts auditJobRunOptions, jobLogContent string) error {
1018 failingStepNum, failingStepOutput := findFirstFailingStep(jobLogContent)

Callers 1

extractAuditJobDetailsFunction · 0.85

Calls 4

FormatWarningMessageFunction · 0.92
FormatSuccessMessageFunction · 0.92
extractStepOutputFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected