-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add updating draft state to update_pull_request
tool
#774
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
Conversation
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 draft state management functionality to the update_pull_request
tool, allowing users to mark pull requests as drafts or ready for review through GraphQL mutations.
- Adds a new
draft
boolean parameter to theupdate_pull_request
tool - Implements GraphQL-based draft state mutations (
convertPullRequestToDraft
andmarkPullRequestReadyForReview
) - Updates the tool to handle both REST API updates for traditional fields and GraphQL mutations for draft state changes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/github/tools.go | Updates function signature to include GraphQL client parameter |
pkg/github/pullrequests.go | Adds draft parameter handling and GraphQL mutation logic for draft state changes |
pkg/github/pullrequests_test.go | Adds comprehensive test coverage for draft functionality with mock GraphQL clients |
pkg/github/toolsnaps/update_pull_request.snap | Updates tool schema snapshot to include new draft parameter |
README.md | Documents the new draft parameter in the tool usage section |
Comments suppressed due to low confidence (1)
pkg/github/pullrequests.go:456
- The comment is misleading - it says 'Current state is draft' but the value is false, indicating it's not a draft. The comment should be corrected to reflect the actual state.
mcp.Enum("asc", "desc"),
client, err := getClient(ctx) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
return nil, 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.
The REST client is retrieved twice in this function (lines 311 and 400). Consider retrieving it once at the beginning and reusing it to improve efficiency and reduce duplication.
} | |
// Reuse the client retrieved earlier |
Copilot uses AI. Check for mistakes.
Closes: #501 and #423
This is a copy of the comment in issue 501:
I've had a look at implementing this as an extension of the
update_pull_request
tool (using GraphQL). I've chosen to use a newdraft
parameter as a boolean for this for a few reasons: