Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add updating draft state toupdate_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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mattdholloway merged 6 commits intomainfrommark-pr-ready-for-review-2
Jul 29, 2025

Conversation

mattdholloway
Copy link
Contributor

@mattdhollowaymattdholloway commentedJul 28, 2025
edited
Loading

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 theupdate_pull_request tool (using GraphQL). I've chosen to use a newdraft parameter as a boolean for this for a few reasons:

  • In the GraphQL spec for pull requests, 'draft' is separate to 'state' as a PR can be both closed as a draft, open as ready for review, etc (ref:
"""The possible states of a pull request."""enum PullRequestState {  """  A pull request that has been closed without being merged.  """  CLOSED  """  A pull request that has been closed by being merged.  """  MERGED  """  A pull request that is still open.  """  OPEN}
  Identifies if the pull request is a draft.  """  isDraft: Boolean!  """
  • Setting if the PR is a draft using GraphQL requires a separate implementation to the current existing REST calls, and I felt it would introduce unneeded complexity having a totally separate code path based on an enum variant

@mattdhollowaymattdholloway marked this pull request as ready for reviewJuly 28, 2025 15:23
@CopilotCopilotAI review requested due to automatic review settingsJuly 28, 2025 15:23
@mattdhollowaymattdholloway requested a review froma team as acode ownerJuly 28, 2025 15:23
Copilot

This comment was marked as outdated.

Copy link
Contributor

@CopilotCopilotAI left a 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 theupdate_pull_request tool, allowing users to mark pull requests as drafts or ready for review through GraphQL mutations.

  • Adds a newdraft 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
FileDescription
pkg/github/tools.goUpdates function signature to include GraphQL client parameter
pkg/github/pullrequests.goAdds draft parameter handling and GraphQL mutation logic for draft state changes
pkg/github/pullrequests_test.goAdds comprehensive test coverage for draft functionality with mock GraphQL clients
pkg/github/toolsnaps/update_pull_request.snapUpdates tool schema snapshot to include new draft parameter
README.mdDocuments 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"),

iferr!=nil {
returnnil,fmt.Errorf("failed to get GitHub client: %w",err)
returnnil,err
}
Copy link
Preview

CopilotAIJul 29, 2025

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.

Suggested change
}
// Reuse the client retrieved earlier

Copilot uses AI. Check for mistakes.

@mattdhollowaymattdholloway merged commitd5e1f48 intomainJul 29, 2025
16 checks passed
@mattdhollowaymattdholloway deleted the mark-pr-ready-for-review-2 branchJuly 29, 2025 09:58
MayorFaj pushed a commit to MayorFaj/github-mcp-server that referenced this pull requestJul 29, 2025
* initial impl of pull request draft state update* appease linter* update README* add nosec* fixed err return type for json marshalling* add gql test
mattdholloway added a commit that referenced this pull requestJul 31, 2025
* feat: add reviewers parameter to UpdatePullRequest and update tests* Update pullrequests.go* feat: enhance update pull request functionality with reviewers support* update README to clarify optional reviewers parameter in API documentation- go run ./cmd/github-mcp-server generate-docs* feat: enhance UpdatePullRequest to return early if no updates or reviewers are provided* Add updating draft state to `update_pull_request` tool (#774)* initial impl of pull request draft state update* appease linter* update README* add nosec* fixed err return type for json marshalling* add gql test* Add support for org-level discussions in list_discussions tool (#775)* make repo optional, and default to .github when not provided. improve tool description* autogen* update tests* small copy paste error fixes* refactor: streamline UpdatePullRequest logic and enhance test cases for reviewer updates* refactor: remove redundant draft update tests and streamline UpdatePullRequest logic* test: add unit tests for updating pull request draft state* refactor: simplify UpdatePullRequest tests by removing unused mock data---------Co-authored-by: Matt Holloway <mattdholloway@github.com>Co-authored-by: Tommaso Moro <37270480+tommaso-moro@users.noreply.github.com>
@Gowza68

This comment was marked as spam.

nickytonline pushed a commit to nickytonline/github-mcp-http that referenced this pull requestOct 4, 2025
* initial impl of pull request draft state update* appease linter* update README* add nosec* fixed err return type for json marshalling* add gql test
nickytonline pushed a commit to nickytonline/github-mcp-http that referenced this pull requestOct 4, 2025
* feat: add reviewers parameter to UpdatePullRequest and update tests* Update pullrequests.go* feat: enhance update pull request functionality with reviewers support* update README to clarify optional reviewers parameter in API documentation- go run ./cmd/github-mcp-server generate-docs* feat: enhance UpdatePullRequest to return early if no updates or reviewers are provided* Add updating draft state to `update_pull_request` tool (github#774)* initial impl of pull request draft state update* appease linter* update README* add nosec* fixed err return type for json marshalling* add gql test* Add support for org-level discussions in list_discussions tool (github#775)* make repo optional, and default to .github when not provided. improve tool description* autogen* update tests* small copy paste error fixes* refactor: streamline UpdatePullRequest logic and enhance test cases for reviewer updates* refactor: remove redundant draft update tests and streamline UpdatePullRequest logic* test: add unit tests for updating pull request draft state* refactor: simplify UpdatePullRequest tests by removing unused mock data---------Co-authored-by: Matt Holloway <mattdholloway@github.com>Co-authored-by: Tommaso Moro <37270480+tommaso-moro@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@almaleksiaalmaleksiaalmaleksia approved these changes

+2 more reviewers

@Gowza68Gowza68Gowza68 approved these changes

@Arturo171Arturo171Arturo171 approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Allow tool to mark PR ready for review
4 participants
@mattdholloway@Gowza68@almaleksia@Arturo171

[8]ページ先頭

©2009-2025 Movatter.jp