-
Notifications
You must be signed in to change notification settings - Fork 7.8k
mntlty/pr to draft #5995
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
mntlty/pr to draft #5995
Conversation
|
Draft pull requests are not available on all repositories and plans according to https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests Attempting to convert a pull request to draft results in the following error: I'm not sure if this is descriptive enough, or if this error should be more informative? |
|
@mislav what do you think about this approach? |
vilmibm
left a comment
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.
I'm down with this approach and the messaging, especially since it's called out in the usage that not all plans support the behavior. Will wait to merge until @mislav has had a chance to chime back in, though.
mislav
left a comment
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.
Looks great; thank you!
Fixes #2271
I updated https://github.com/shurcooL/githubv4 to make use of the
ConvertPullRequestToDraftInputtype.I originally split this into separate functions, which resulted in a lot of variable passing and largely duplicated code. After a refactor I think this is clear enough as two if statements, as the ready command itself is not too long.
In the issue, there is also an enhancement for
gh pr edit, which calls theupdatePullRequestgraphql api. That api does not support converting a pull request to draft https://docs.github.com/en/graphql/reference/input-objects#updatepullrequestinputIt is possible to use the
ConvertPullRequestToDraftfunction I added in that command as well, I'm not sure how closely the cli and the graphql api should align.