(ctx context.Context, client *github.Client, owner, repo string, resourceID int64)
| 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) |
| 1005 | if err != nil { |
| 1006 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get workflow run usage", resp, err), nil, nil |
| 1007 | } |
| 1008 | defer func() { _ = resp.Body.Close() }() |
| 1009 | |
| 1010 | r, err := json.Marshal(usage) |
| 1011 | if err != nil { |
| 1012 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 1013 | } |
| 1014 | |
| 1015 | return utils.NewToolResultText(string(r)), nil, nil |
| 1016 | } |
| 1017 | |
| 1018 | func runWorkflow(ctx context.Context, client *github.Client, owner, repo, workflowID, ref string, inputs map[string]any) (*mcp.CallToolResult, any, error) { |
| 1019 | event := github.CreateWorkflowDispatchEventRequest{ |
no test coverage detected