(ctx context.Context, client *github.Client, owner, repo string, runID int64)
| 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) |
| 1083 | if err != nil { |
| 1084 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to rerun failed jobs", resp, err), nil, nil |
| 1085 | } |
| 1086 | defer func() { _ = resp.Body.Close() }() |
| 1087 | |
| 1088 | result := map[string]any{ |
| 1089 | "message": "Failed jobs have been queued for re-run", |
| 1090 | "run_id": runID, |
| 1091 | "status": resp.Status, |
| 1092 | "status_code": resp.StatusCode, |
| 1093 | } |
| 1094 | |
| 1095 | r, err := json.Marshal(result) |
| 1096 | if err != nil { |
| 1097 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 1098 | } |
| 1099 | |
| 1100 | return utils.NewToolResultText(string(r)), nil, nil |
| 1101 | } |
| 1102 | |
| 1103 | func cancelWorkflowRun(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) { |
| 1104 | resp, err := client.Actions.CancelWorkflowRunByID(ctx, owner, repo, runID) |
no test coverage detected