(ctx context.Context, client *github.Client, args map[string]any, owner, repo string, resourceID int64, pagination PaginationParams)
| 893 | } |
| 894 | |
| 895 | func listWorkflowJobs(ctx context.Context, client *github.Client, args map[string]any, owner, repo string, resourceID int64, pagination PaginationParams) (*mcp.CallToolResult, any, error) { |
| 896 | filterArgs, err := OptionalParam[map[string]any](args, "workflow_jobs_filter") |
| 897 | if err != nil { |
| 898 | return utils.NewToolResultError(err.Error()), nil, nil |
| 899 | } |
| 900 | |
| 901 | filterArgsTyped := make(map[string]string) |
| 902 | for k, v := range filterArgs { |
| 903 | if strVal, ok := v.(string); ok { |
| 904 | filterArgsTyped[k] = strVal |
| 905 | } else { |
| 906 | filterArgsTyped[k] = "" |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | workflowJobs, resp, err := client.Actions.ListWorkflowJobs(ctx, owner, repo, resourceID, &github.ListWorkflowJobsOptions{ |
| 911 | Filter: filterArgsTyped["filter"], |
| 912 | ListOptions: github.ListOptions{ |
| 913 | Page: pagination.Page, |
| 914 | PerPage: pagination.PerPage, |
| 915 | }, |
| 916 | }) |
| 917 | if err != nil { |
| 918 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to list workflow jobs", resp, err), nil, nil |
| 919 | } |
| 920 | |
| 921 | response := map[string]any{ |
| 922 | "jobs": workflowJobs, |
| 923 | } |
| 924 | |
| 925 | defer func() { _ = resp.Body.Close() }() |
| 926 | r, err := json.Marshal(response) |
| 927 | if err != nil { |
| 928 | return nil, nil, fmt.Errorf("failed to marshal workflow jobs: %w", err) |
| 929 | } |
| 930 | |
| 931 | return utils.NewToolResultText(string(r)), nil, nil |
| 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{ |
no test coverage detected