(ctx context.Context, client *github.Client, owner, repo string, runID int64)
| 1057 | } |
| 1058 | |
| 1059 | func rerunWorkflowRun(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) { |
| 1060 | resp, err := client.Actions.RerunWorkflowByID(ctx, owner, repo, runID) |
| 1061 | if err != nil { |
| 1062 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to rerun workflow run", resp, err), nil, nil |
| 1063 | } |
| 1064 | defer func() { _ = resp.Body.Close() }() |
| 1065 | |
| 1066 | result := map[string]any{ |
| 1067 | "message": "Workflow run has been queued for re-run", |
| 1068 | "run_id": runID, |
| 1069 | "status": resp.Status, |
| 1070 | "status_code": resp.StatusCode, |
| 1071 | } |
| 1072 | |
| 1073 | r, err := json.Marshal(result) |
| 1074 | if err != nil { |
| 1075 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 1076 | } |
| 1077 | |
| 1078 | return utils.NewToolResultText(string(r)), nil, nil |
| 1079 | } |
| 1080 | |
| 1081 | func rerunFailedJobs(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) { |
| 1082 | resp, err := client.Actions.RerunFailedJobsByID(ctx, owner, repo, runID) |
no test coverage detected