(ctx context.Context, client *github.Client, owner, repo string, resourceID int64, pagination PaginationParams)
| 932 | } |
| 933 | |
| 934 | func listWorkflowArtifacts(ctx context.Context, client *github.Client, owner, repo string, resourceID int64, pagination PaginationParams) (*mcp.CallToolResult, any, error) { |
| 935 | opts := &github.ListOptions{ |
| 936 | PerPage: pagination.PerPage, |
| 937 | Page: pagination.Page, |
| 938 | } |
| 939 | |
| 940 | artifacts, resp, err := client.Actions.ListWorkflowRunArtifacts(ctx, owner, repo, resourceID, opts) |
| 941 | if err != nil { |
| 942 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to list workflow run artifacts", resp, err), nil, nil |
| 943 | } |
| 944 | defer func() { _ = resp.Body.Close() }() |
| 945 | |
| 946 | r, err := json.Marshal(artifacts) |
| 947 | if err != nil { |
| 948 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 949 | } |
| 950 | |
| 951 | return utils.NewToolResultText(string(r)), nil, nil |
| 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 |
no test coverage detected