@@ -16,12 +16,15 @@ import (
1616
1717 "github.com/githubnext/gh-aw/pkg/console"
1818 "github.com/githubnext/gh-aw/pkg/constants"
19+ "github.com/githubnext/gh-aw/pkg/logger"
1920 "github.com/githubnext/gh-aw/pkg/workflow"
2021 "github.com/githubnext/gh-aw/pkg/workflow/pretty"
2122 "github.com/sourcegraph/conc/pool"
2223 "github.com/spf13/cobra"
2324)
2425
26+ var logsLog = logger .New ("cli:logs" )
27+
2528const (
2629 // defaultAgentStdioLogPath is the default log file path for agent stdout/stderr
2730 defaultAgentStdioLogPath = "/tmp/gh-aw/agent-stdio.log"
@@ -130,6 +133,7 @@ type RunSummary struct {
130133
131134// fetchJobStatuses gets job information for a workflow run and counts failed jobs
132135func fetchJobStatuses (runID int64 , verbose bool ) (int , error ) {
136+ logsLog .Printf ("Fetching job statuses: runID=%d" , runID )
133137 args := []string {"api" , fmt .Sprintf ("repos/{owner}/{repo}/actions/runs/%d/jobs" , runID ), "--jq" , ".jobs[] | {name: .name, status: .status, conclusion: .conclusion}" }
134138
135139 if verbose {
@@ -165,12 +169,14 @@ func fetchJobStatuses(runID int64, verbose bool) (int, error) {
165169 // Count jobs with failure conclusions as errors
166170 if job .Conclusion == "failure" || job .Conclusion == "cancelled" || job .Conclusion == "timed_out" {
167171 failedJobs ++
172+ logsLog .Printf ("Found failed job: name=%s, conclusion=%s" , job .Name , job .Conclusion )
168173 if verbose {
169174 fmt .Println (console .FormatVerboseMessage (fmt .Sprintf ("Found failed job '%s' with conclusion '%s'" , job .Name , job .Conclusion )))
170175 }
171176 }
172177 }
173178
179+ logsLog .Printf ("Job status check complete: failedJobs=%d" , failedJobs )
174180 return failedJobs , nil
175181}
176182
@@ -436,6 +442,7 @@ Examples:
436442
437443// DownloadWorkflowLogs downloads and analyzes workflow logs with metrics
438444func DownloadWorkflowLogs (workflowName string , count int , startDate , endDate , outputDir , engine , branch string , beforeRunID , afterRunID int64 , verbose bool , toolGraph bool , noStaged bool , parse bool , jsonOutput bool , timeout int ) error {
445+ logsLog .Printf ("Starting workflow log download: workflow=%s, count=%d, startDate=%s, endDate=%s, outputDir=%s" , workflowName , count , startDate , endDate , outputDir )
439446 if verbose {
440447 fmt .Fprintln (os .Stderr , console .FormatInfoMessage ("Fetching workflow runs from GitHub Actions..." ))
441448 }
@@ -785,6 +792,7 @@ func downloadRunArtifactsConcurrent(runs []WorkflowRun, outputDir string, verbos
785792 // Limit the number of runs to process if maxRuns is specified
786793 actualRuns := runs
787794 if maxRuns > 0 && len (runs ) > maxRuns {
795+ logsLog .Printf ("Limiting concurrent downloads: maxRuns=%d, totalRuns=%d" , maxRuns , len (runs ))
788796 actualRuns = runs [:maxRuns ]
789797 }
790798
0 commit comments