feat: add reviewers parameter to create_pull_request#814
feat: add reviewers parameter to create_pull_request#814yukukotani wants to merge 3 commits intogithub:mainfrom
Conversation
- Add reviewers parameter to create_pull_request tool matching update_pull_request - Request reviewers after PR creation using GitHub API - Refresh PR data after adding reviewers to return complete information - Add comprehensive test coverage for the new parameter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…equest - Add reviewers parameter documentation to match the implementation - Maintain alphabetical order of parameters in the list 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change array[string] to string[] to match existing documentation style - Consistent with other array parameters in the README 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for specifying reviewers when creating a pull request, bringing feature parity with the existing update_pull_request functionality.
- Add
reviewersparameter tocreate_pull_requesttool for requesting reviews upon PR creation - Implement reviewer request flow that calls GitHub's RequestReviewers API after PR creation
- Add comprehensive test coverage for the new parameter functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/github/pullrequests.go | Adds reviewers parameter and implements reviewer request logic after PR creation |
| pkg/github/pullrequests_test.go | Adds test coverage for PR creation with reviewers functionality |
| pkg/github/toolsnaps/create_pull_request.snap | Updates tool schema snapshot to include reviewers parameter |
| README.md | Documents the new reviewers parameter in the tool documentation |
| if reviewResp.StatusCode != http.StatusCreated && reviewResp.StatusCode != http.StatusOK { | ||
| body, err := io.ReadAll(reviewResp.Body) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to read response body: %w", err) |
There was a problem hiding this comment.
This return statement returns a nil *mcp.CallToolResult and an error, which is inconsistent with the function signature that expects (*mcp.CallToolResult, error). This should return an mcp.NewToolResultError instead of returning nil and an error.
| return nil, fmt.Errorf("failed to read response body: %w", err) | |
| return mcp.NewToolResultError(fmt.Sprintf("failed to read response body: %v", err)), nil |
| err, | ||
| ), nil | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
There was a problem hiding this comment.
The defer statement for closing resp.Body should include a nil check for resp to avoid potential panics. This should be: defer func() { if resp != nil && resp.Body != nil { _ = resp.Body.Close() } }()
| defer func() { _ = resp.Body.Close() }() | |
| defer func() { | |
| if resp != nil && resp.Body != nil { | |
| _ = resp.Body.Close() | |
| } | |
| }() |
|
wtf is this spam |
Summary
This PR adds support for specifying reviewers when creating a pull request, bringing feature parity with the
update_pull_requesttool which already supports this functionality.Changes
reviewersparameter tocreate_pull_requesttoolImplementation Details
The implementation follows the same pattern as
update_pull_request:reviewersparameterRequestReviewersAPI if reviewers are specifiedTesting
Related
This brings consistency with PR #285 which added reviewers parameter to
update_pull_request.🤖 Generated with Claude Code