(ctx context.Context, client *github.Client, owner, repo string, resourceID int64)
| 952 | } |
| 953 | |
| 954 | func downloadWorkflowArtifact(ctx context.Context, client *github.Client, owner, repo string, resourceID int64) (*mcp.CallToolResult, any, error) { |
| 955 | // Get the download URL for the artifact |
| 956 | url, resp, err := client.Actions.DownloadArtifact(ctx, owner, repo, resourceID, 1) |
| 957 | if err != nil { |
| 958 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get artifact download URL", resp, err), nil, nil |
| 959 | } |
| 960 | defer func() { _ = resp.Body.Close() }() |
| 961 | |
| 962 | // Create response with the download URL and information |
| 963 | result := map[string]any{ |
| 964 | "download_url": url.String(), |
| 965 | "message": "Artifact is available for download", |
| 966 | "note": "The download_url provides a download link for the artifact as a ZIP archive. The link is temporary and expires after a short time.", |
| 967 | "artifact_id": resourceID, |
| 968 | } |
| 969 | |
| 970 | r, err := json.Marshal(result) |
| 971 | if err != nil { |
| 972 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 973 | } |
| 974 | |
| 975 | return utils.NewToolResultText(string(r)), nil, nil |
| 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 |
no test coverage detected