-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: add reviewers parameter to create_pull_request #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
reviewers
parameter tocreate_pull_request
tool 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot uses AI. Check for mistakes.
err, | ||
), nil | ||
} | ||
defer func() { _ = resp.Body.Close() }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() | |
} | |
}() |
Copilot uses AI. Check for mistakes.
4 Ağu 2025 Pzt 03:58 tarihinde Yuku Kotani ***@***.***> şunu
yazdı:
… ***@***.**** commented on this pull request.
------------------------------
In pkg/github/pullrequests.go
<#814 (comment)>
:
> + return ghErrors.NewGitHubAPIErrorResponse(ctx,
+ "failed to request reviewers",
+ reviewResp,
+ err,
+ ), nil
+ }
+ defer func() {
+ if reviewResp != nil && reviewResp.Body != nil {
+ _ = reviewResp.Body.Close()
+ }
+ }()
+
+ 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)
@copilot <https://gh.io/copilot-coding-agent-docs> It seems that the
other functions also use this pattern when failing to read response body
—
Reply to this email directly, view it on GitHub
<#814 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BOESNUKW5FUXKSBI5SSINLD3L2V33AVCNFSM6AAAAACDAUBIF2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTAOBSGQ2DSMRZGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
4 Ağu 2025 Pzt 04:17 tarihinde Ali Gülege ***@***.***> şunu
yazdı:
…
4 Ağu 2025 Pzt 03:58 tarihinde Yuku Kotani ***@***.***>
şunu yazdı:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In pkg/github/pullrequests.go
> <#814 (comment)>
> :
>
> > + return ghErrors.NewGitHubAPIErrorResponse(ctx,
> + "failed to request reviewers",
> + reviewResp,
> + err,
> + ), nil
> + }
> + defer func() {
> + if reviewResp != nil && reviewResp.Body != nil {
> + _ = reviewResp.Body.Close()
> + }
> + }()
> +
> + 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)
>
> @copilot <https://gh.io/copilot-coding-agent-docs> It seems that the
> other functions also use this pattern when failing to read response body
>
> —
> Reply to this email directly, view it on GitHub
> <#814 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BOESNUKW5FUXKSBI5SSINLD3L2V33AVCNFSM6AAAAACDAUBIF2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTAOBSGQ2DSMRZGY>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
wtf is this spam |
4 Ağu 2025 Pzt 04:35 tarihinde Yuku Kotani ***@***.***> şunu
yazdı:
… *yukukotani* left a comment (github/github-mcp-server#814)
<#814 (comment)>
wtf is this spam
—
Reply to this email directly, view it on GitHub
<#814 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BOESNUIAT5VZRUTPKAIQGYD3L22HFAVCNFSM6AAAAACDAUBIF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNBYHA4DAOJXHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
4 Ağu 2025 Pzt 04:50 tarihinde Ali Gülege ***@***.***> şunu
yazdı:
…
4 Ağu 2025 Pzt 04:35 tarihinde Yuku Kotani ***@***.***>
şunu yazdı:
> *yukukotani* left a comment (github/github-mcp-server#814)
> <#814 (comment)>
>
> wtf is this spam
>
> —
> Reply to this email directly, view it on GitHub
> <#814 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BOESNUIAT5VZRUTPKAIQGYD3L22HFAVCNFSM6AAAAACDAUBIF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNBYHA4DAOJXHE>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Summary
This PR adds support for specifying reviewers when creating a pull request, bringing feature parity with the
update_pull_request
tool which already supports this functionality.Changes
reviewers
parameter tocreate_pull_request
toolImplementation Details
The implementation follows the same pattern as
update_pull_request
:reviewers
parameterRequestReviewers
API if reviewers are specifiedTesting
Related
This brings consistency with PR #285 which added reviewers parameter to
update_pull_request
.🤖 Generated with Claude Code