(ctx context.Context, client *github.Client, owner, repo string, runID int64)
| 976 | } |
| 977 | |
| 978 | func getWorkflowRunLogsURL(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) { |
| 979 | // Get the download URL for the logs |
| 980 | url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, owner, repo, runID, 1) |
| 981 | if err != nil { |
| 982 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get workflow run logs", resp, err), nil, nil |
| 983 | } |
| 984 | defer func() { _ = resp.Body.Close() }() |
| 985 | |
| 986 | // Create response with the logs URL and information |
| 987 | result := map[string]any{ |
| 988 | "logs_url": url.String(), |
| 989 | "message": "Workflow run logs are available for download", |
| 990 | "note": "The logs_url provides a download link for the complete workflow run logs as a ZIP archive. You can download this archive to extract and examine individual job logs.", |
| 991 | "warning": "This downloads ALL logs as a ZIP file which can be large and expensive. For debugging failed jobs, consider using get_job_logs with failed_only=true and run_id instead.", |
| 992 | "optimization_tip": "Use: get_job_logs with parameters {run_id: " + fmt.Sprintf("%d", runID) + ", failed_only: true} for more efficient failed job debugging", |
| 993 | } |
| 994 | |
| 995 | r, err := json.Marshal(result) |
| 996 | if err != nil { |
| 997 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 998 | } |
| 999 | |
| 1000 | return utils.NewToolResultText(string(r)), nil, nil |
| 1001 | } |
| 1002 | |
| 1003 | func getWorkflowRunUsage(ctx context.Context, client *github.Client, owner, repo string, resourceID int64) (*mcp.CallToolResult, any, error) { |
| 1004 | usage, resp, err := client.Actions.GetWorkflowRunUsageByID(ctx, owner, repo, resourceID) |
no test coverage detected