(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams)
| 359 | } |
| 360 | |
| 361 | func GetPullRequestFiles(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) { |
| 362 | opts := &github.ListOptions{ |
| 363 | PerPage: pagination.PerPage, |
| 364 | Page: pagination.Page, |
| 365 | } |
| 366 | files, resp, err := client.PullRequests.ListFiles(ctx, owner, repo, pullNumber, opts) |
| 367 | if err != nil { |
| 368 | return ghErrors.NewGitHubAPIErrorResponse(ctx, |
| 369 | "failed to get pull request files", |
| 370 | resp, |
| 371 | err, |
| 372 | ), nil |
| 373 | } |
| 374 | defer func() { _ = resp.Body.Close() }() |
| 375 | |
| 376 | if resp.StatusCode != http.StatusOK { |
| 377 | body, err := io.ReadAll(resp.Body) |
| 378 | if err != nil { |
| 379 | return nil, fmt.Errorf("failed to read response body: %w", err) |
| 380 | } |
| 381 | return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get pull request files", resp, body), nil |
| 382 | } |
| 383 | |
| 384 | minimalFiles := convertToMinimalPRFiles(files) |
| 385 | |
| 386 | return MarshalledTextResult(minimalFiles), nil |
| 387 | } |
| 388 | |
| 389 | func GetPullRequestCommits(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) { |
| 390 | opts := &github.ListOptions{ |
no test coverage detected