(ctx context.Context, client *github.Client, owner, repo string, runID int64)
| 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) |
| 1105 | if err != nil { |
| 1106 | var acceptedErr *github.AcceptedError |
| 1107 | if !errors.As(err, &acceptedErr) { |
| 1108 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to cancel workflow run", resp, err), nil, nil |
| 1109 | } |
| 1110 | } |
| 1111 | defer func() { _ = resp.Body.Close() }() |
| 1112 | |
| 1113 | result := map[string]any{ |
| 1114 | "message": "Workflow run has been cancelled", |
| 1115 | "run_id": runID, |
| 1116 | "status": resp.Status, |
| 1117 | "status_code": resp.StatusCode, |
| 1118 | } |
| 1119 | |
| 1120 | r, err := json.Marshal(result) |
| 1121 | if err != nil { |
| 1122 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 1123 | } |
| 1124 | |
| 1125 | return utils.NewToolResultText(string(r)), nil, nil |
| 1126 | } |
| 1127 | |
| 1128 | func deleteWorkflowRunLogs(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) { |
| 1129 | resp, err := client.Actions.DeleteWorkflowRunLogs(ctx, owner, repo, runID) |
no test coverage detected