MCPcopy Index your code
hub / github.com/github/github-mcp-server / GetPullRequestCommits

Function GetPullRequestCommits

pkg/github/pullrequests.go:389–415  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams)

Source from the content-addressed store, hash-verified

387}
388
389func GetPullRequestCommits(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) {
390 opts := &github.ListOptions{
391 PerPage: pagination.PerPage,
392 Page: pagination.Page,
393 }
394 commits, resp, err := client.PullRequests.ListCommits(ctx, owner, repo, pullNumber, opts)
395 if err != nil {
396 return ghErrors.NewGitHubAPIErrorResponse(ctx,
397 "failed to get pull request commits",
398 resp,
399 err,
400 ), nil
401 }
402 defer func() { _ = resp.Body.Close() }()
403
404 if resp.StatusCode != http.StatusOK {
405 body, err := io.ReadAll(resp.Body)
406 if err != nil {
407 return nil, fmt.Errorf("failed to read response body: %w", err)
408 }
409 return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get pull request commits", resp, body), nil
410 }
411
412 minimalCommits := convertToMinimalPullRequestCommits(commits)
413
414 return MarshalledTextResult(minimalCommits), nil
415}
416
417// GraphQL types for review threads query
418type reviewThreadsQuery struct {

Callers 1

PullRequestReadFunction · 0.85

Calls 3

MarshalledTextResultFunction · 0.85
CloseMethod · 0.80

Tested by

no test coverage detected