-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Add mark_pr_ready_for_review tool #423
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
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
Introduce a new tool to transition draft GitHub pull requests to ready-for-review state via GraphQL, including command registration, implementation, and tests.
- Register the
mark_pr_ready_for_review
tool in the server toolset. - Implement the GraphQL query and mutation for marking a PR as ready for review.
- Add comprehensive unit tests for success and failure scenarios.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
pkg/github/tools.go | Register new mark_pr_ready_for_review tool. |
pkg/github/pullrequests.go | Implement GraphQL logic for marking draft PRs as ready for review. |
pkg/github/pullrequests_test.go | Add unit tests covering various success/failure cases for the new tool. |
Comments suppressed due to low confidence (2)
pkg/github/pullrequests_test.go:2295
- Add a test case for failure to obtain the GraphQL client (e.g., have
getGQLClient
return an error) to verify the handler surfaces this as a tool error instead of returning a raw error.
func TestMarkPullRequestReadyForReview(t *testing.T) {
pkg/github/pullrequests.go:1638
- Add a test to cover parameter decoding failures (e.g., missing or wrong-type
owner
/repo
/pullNumber
) so you can confirm those errors are returned as tool errors.
if err := mapstructure.Decode(request.Params.Arguments, ¶ms); err != nil {
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
Adds a new CLI tool (mark_pr_ready_for_review
) that transitions a draft GitHub pull request to ready-for-review via the GraphQL API.
- Registers the new tool in the existing toolset.
- Implements the GraphQL query/mutation logic in
pullrequests.go
. - Provides comprehensive unit tests for success and failure scenarios.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/github/tools.go | Registers MarkPullRequestReadyForReview in toolset |
pkg/github/pullrequests.go | Implements the new GraphQL-based ready-for-review tool |
pkg/github/pullrequests_test.go | Adds tests covering all new tool behaviors |
Comments suppressed due to low confidence (1)
pkg/github/pullrequests.go:1664
- The local variables
owner
,repo
, andpullNumber
are parsed above, but the code mistakenly references an undefinedparams
struct here. Update thevariables
map to use the parsed locals, e.g.:"owner": githubv4.String(owner)
,"repo": githubv4.String(repo)
, and"prNum": githubv4.Int(pullNumber)
.
"owner": githubv4.String(params.Owner),
8731a4c
to
43d6692
Compare
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 introduces a new tool, mark_pr_ready_for_review, to change a draft pull request into a ready for review state by using the GitHub GraphQL API.
- Registers the new tool in the toolset.
- Implements the GraphQL mutation to mark PRs as ready.
- Adds comprehensive tests to validate the tool's behavior.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/github/tools.go | Registers the new MarkPullRequestReadyForReview tool |
pkg/github/pullrequests_test.go | Adds tests covering success and various failure scenarios for the new tool |
pkg/github/pullrequests.go | Implements the GraphQL logic for marking a pull request ready for review |
43d6692
to
2b5ec67
Compare
Thanks very much for the contribution @efouts I was thinking about this PR and wondering if it might make sense to convert it to |
@SamMorrowDrums happy to do that or add another tool mirroring the (edit) I went ahead and updated to be |
2b5ec67
to
650aac6
Compare
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 a new tool, mark_pr_ready_for_review, to allow changing a GitHub pull request's state from draft to ready-for-review (and vice versa), using the GitHub GraphQL API.
- Added a new tool registration (SetPRStatus) in pkg/github/tools.go.
- Implemented the tool logic in pkg/github/pullrequests.go with corresponding tests in pkg/github/pullrequests_test.go.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/github/tools.go | Registers the new SetPRStatus tool in the toolset. |
pkg/github/pullrequests_test.go | Adds comprehensive tests for both state transition paths. |
pkg/github/pullrequests.go | Implements the GraphQL logic for setting the pull request status. |
@SamMorrowDrums can you help with next steps to get this new tool added? |
@williammartin @SamMorrowDrums let me know what is needed to get this one merged. |
d66769f
to
fcbc256
Compare
@SamMorrowDrums @williammartin having the ability for agents to create draft PRs and mark them ready later would be very valuable to me and I believe others building agents which will work with PRs on Github. please let me know what I can do to get it across the finish line. I don't want it to become abandoned if it is a valuable addition. |
Hi @efouts don't worry, we haven't forgotten. Focus has been on building out the remote server which launched yesterday, but we are going through these PRs. Apologies for the delay. |
thanks @SamMorrowDrums, if you'd like me to update the branch and do another round of testing. let me know when you plan to take a look. |
This commit introduces a new tool that allows changing a GitHub pull request from draft state to ready for review. The implementation uses GitHub's GraphQL API with the 'markPullRequestReadyForReview' mutation, as the REST API doesn't support this state transition for existing draft PRs. Also fixes the GraphQL query by correcting 'Draft' to 'IsDraft' field name, ensuring proper detection of a PR's draft status. The changes include: - New tool implementation in the pull_requests toolset - Comprehensive tests - GraphQL query field correction
Based on code review feedback, made the following improvements: - Rename 'variables' to 'vars' for consistency with other GraphQL functions - Improve comment precision for GraphQL schema requirements These changes enhance code consistency and documentation clarity while maintaining full functionality. All tests, linting, and build checks pass.
- Replace mark_pr_ready_for_review with set_pr_status tool - Add bidirectional PR status changes (draft ↔ ready_for_review) - Use enum parameter for status: "draft", "ready_for_review" - Implement GraphQL mutations for both directions - Add comprehensive test suite with 8 test scenarios - Remove deprecated MarkPullRequestReadyForReview function Addresses user feedback to provide enum-based PR status management with support for setting PRs to both draft and ready-for-review states.
fcbc256
to
6325c03
Compare
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 introduces a new tool to change a pull request's status between draft and ready-for-review using the GitHub GraphQL API. Key changes include the registration of the new tool in the toolset, its implementation in the pullrequests package via GraphQL mutations, and comprehensive tests covering various transition scenarios.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/github/tools.go | Registers the new SetPRStatus tool in the toolset |
pkg/github/pullrequests_test.go | Adds tests to verify the status transitions and mutation error cases |
pkg/github/pullrequests.go | Implements the GraphQL-based logic for updating pull request status |
rebased to get up to date with main, fixed a typo after rebase, and tested creating a PR as draft, marking as ready, setting back to draft, and trying to set an invalid status. |
This commit introduces a new tool,
mark_pr_ready_for_review
, which allows changing a GitHub pull request from a draft state to ready for review.This tool utilizes the GitHub GraphQL API's
markPullRequestReadyForReview
mutation, as the REST API does not support this specific state transition for existing draft PRs.The implementation includes the tool logic, its registration in the pull_requests toolset, and comprehensive tests.