Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/patch-progress-indicator-workflow-runs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions pkg/cli/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func DownloadWorkflowLogs(workflowName string, count int, startDate, endDate, ou
}
}

runs, totalFetched, err := listWorkflowRunsWithPagination(workflowName, batchSize, startDate, endDate, beforeDate, branch, beforeRunID, afterRunID, verbose)
runs, totalFetched, err := listWorkflowRunsWithPagination(workflowName, batchSize, startDate, endDate, beforeDate, branch, beforeRunID, afterRunID, len(processedRuns), count, verbose)
if err != nil {
return err
}
Expand Down Expand Up @@ -789,7 +789,9 @@ func downloadRunArtifactsConcurrent(runs []WorkflowRun, outputDir string, verbos
//
// The limit parameter specifies the batch size for the GitHub API call (how many runs to fetch in this request),
// not the total number of matching runs the user wants to find.
func listWorkflowRunsWithPagination(workflowName string, limit int, startDate, endDate, beforeDate, branch string, beforeRunID, afterRunID int64, verbose bool) ([]WorkflowRun, int, error) {
//
// The processedCount and targetCount parameters are used to display progress in the spinner message.
func listWorkflowRunsWithPagination(workflowName string, limit int, startDate, endDate, beforeDate, branch string, beforeRunID, afterRunID int64, processedCount, targetCount int, verbose bool) ([]WorkflowRun, int, error) {
args := []string{"run", "list", "--json", "databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle"}

// Add filters
Expand Down Expand Up @@ -819,7 +821,8 @@ func listWorkflowRunsWithPagination(workflowName string, limit int, startDate, e
}

// Start spinner for network operation
spinner := console.NewSpinner("Fetching workflow runs from GitHub...")
spinnerMsg := fmt.Sprintf("Fetching workflow runs from GitHub... (%d / %d)", processedCount, targetCount)
spinner := console.NewSpinner(spinnerMsg)
if !verbose {
spinner.Start()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func TestListWorkflowRunsWithPagination(t *testing.T) {

// This should fail with authentication error (if not authenticated)
// or succeed with empty results (if authenticated but no workflows match)
runs, _, err := listWorkflowRunsWithPagination("nonexistent-workflow", 5, "", "", "2024-01-01T00:00:00Z", "", 0, 0, false)
runs, _, err := listWorkflowRunsWithPagination("nonexistent-workflow", 5, "", "", "2024-01-01T00:00:00Z", "", 0, 0, 0, 5, false)

if err != nil {
// If there's an error, it should be an authentication error or workflow not found
Expand Down
Loading