Merged
Conversation
Collaborator
Author
|
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? |
Collaborator
Author
|
@mislav what do you think about this approach? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.