Skip to content
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

Merged
merged 6 commits into from Sep 21, 2022
Merged

mntlty/pr to draft #5995

merged 6 commits into from Sep 21, 2022

Conversation

mntlty
Copy link
Contributor

@mntlty mntlty commented Jul 25, 2022

Fixes #2271

I updated https://github.com/shurcooL/githubv4 to make use of the ConvertPullRequestToDraftInput type.

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 the updatePullRequest graphql api. That api does not support converting a pull request to draft https://docs.github.com/en/graphql/reference/input-objects#updatepullrequestinput
It is possible to use the ConvertPullRequestToDraft function I added in that command as well, I'm not sure how closely the cli and the graphql api should align.

@mntlty mntlty requested a review from a team as a code owner Jul 25, 2022
@mntlty mntlty requested review from mislav (assigned from cli/code-reviewers) and removed request for a team Jul 25, 2022
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Jul 25, 2022
@mntlty
Copy link
Contributor Author

mntlty commented Jul 25, 2022

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:

API call failed: Message: mntlty does not have permission to convert the pull request PR_XXXXX to draft., Locations: [{Line:1 Column:76}]

I'm not sure if this is descriptive enough, or if this error should be more informative?

@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Jul 25, 2022
@mntlty
Copy link
Contributor Author

mntlty commented Aug 1, 2022

@mislav what do you think about this approach?

Copy link
Member

@vilmibm vilmibm left a comment

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.

The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Aug 16, 2022
mislav
mislav approved these changes Sep 21, 2022
Copy link
Member

@mislav mislav left a comment

Looks great; thank you!

@mislav mislav enabled auto-merge (squash) Sep 21, 2022
@mislav mislav merged commit 49f6b20 into trunk Sep 21, 2022
10 checks passed
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Sep 21, 2022
@mislav mislav deleted the mntlty/pr_to_draft branch Sep 21, 2022
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external pull request originating outside of the CLI core team
Projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

Move PR from ready to Draft
4 participants