I would like to update the description of a pull request.
Is this already implemented or can I make a feature request of this?
See: https://developer.github.com/v3/pulls/#update-a-pull-request
I'm fairly certain that this feature does not currently exist. The maintainer seems to not have much time to devote to every feature update in this project, as there are many proposed features to review (good luck with a PR review). Personally, I think this feature would be a good addition.
Updating a PR isn't implemented yet, but since we have hub release edit
command already, editing of issues/PRs might be implemented in the future.
For now I've used the octokit.net library which worked even better for me since hub in combination with the command line seems to have a max pull request body length.
For me this issue has low priority as of now :smile:.
Being able to update the PR would be great, even if just certain parts initially.
I'm combining hub
with ghi
for my current workflow of updating the labels of PRs from the command line, but it would be great if this was possible using just hub
.
Here is a short script using them together: https://gist.github.com/strokirk/afd1b292d51f57453bfb2d609e75792d
since hub in combination with the command line seems to have a max pull request body length.
@devedse There is no code in hub that limits pull request body length. If you think you have discovered a bug, please open another issue and tell us how you passed the body text to hub pull-request
, thank you!
In hub master there is now the hub issue update <NUMBER>
command #2432 which can update the following fields of an issue or pull request:
Updating PR-specific fields such as base
or draft
is still unsupported, but is always possible via hub api
: https://github.com/github/hub/issues/2312#issuecomment-544626863
I've tried updating "draft" via the example in #2312, and it doesn't work. Updating other things such as "title" worked fine.
Same experience here @dcsobral. I can change fields like the title with hub
, the v3 ReST API, and the v4 GraphQL API, but I have no clue how to convert-to-draft
or ready-for-review
a PR. I see the GitHub web UI calling backend functions named this way, but neither the API docs show me how to change the draft status nor would the hub
allow to do that (the above call seems to explore the generic API call feature anyhow, so this doesn't come as a surprise, but I tried it nevertheless/just in case).
Do you in the meantime or does anybody know how to tweak the draft status of a GitHub PR programmatically?
@vlerenc Above was linked an example on how you can programmatically change a PR's status from draft to ready-to-review https://github.com/github/hub/issues/2312#issuecomment-544626863
Yes, I know, but it's not working @mislav . You wrote "This is untested.". I tested it and it doesn't work. I can change fields like the title with v3 and v4 and hub
, which in the end calls v3, but neither allows to make a draft ready or turn a ready PR into a draft. The GitHub API also in its docs doesn't seem to support it, I believe. Or do you know for sure, that this works? If, then it must work differently than the command in that comment.
@vlerenc You are right. I think the only way is to use the GraphQL API. This should work: https://github.com/mislav/hub-api-utils/blob/master/bin/hub-pr-ready
Awesome @mislav, thank you very much. You used the mutation markPullRequestReadyForReview
and it does work. I missed that one and stumbled only across the missing draft
field in the updatePullRequest
mutation. Do you happen to know also the other way around, i.e. how to turn a ready PR again into a draft? I don't see a corresponding mutation, but maybe there is another way to achieve that outcome?
@vlerenc There does _not_ seem to be a programmatic way to convert a PR into a draft PR. This feature only landed in the web UI very recently, and usually it takes a bit for new features to make their way into stable APIs.
@mislav Thank you very much for taking the time to check and answer. Well, you taught me one way and maybe the other will open up eventually as well.
You know, we have a little bot for our project that deals with labels, milestones, PRs, etc. (comments may trigger commands, available only if the sender is a maintainer). Forcing a PR back into draft state is a useful thing to have for a maintainer, so I might want to raise a feature request at GitHub. Do you know where I would do that ideally?
It seems, there is a community forum, but it's in read-only for some days now: https://github.community. I didn't notice and thought I am too dumb to open a discussion as the button was inactive here: https://github.community/t5/GitHub-API-Development-and/bd-p/api. Or maybe it makes sense to ask at https://github.community/t5/How-to-use-Git-and-GitHub/Feature-Request-Switch-from-ready-to-draft-in-pull-requests/td-p/19107/page/7 when then plan to add programmatic means, but right now I see no way to append a post/ask a question.
If you have an advice, that would be great. Thanks for your help already.
Forcing a PR back into draft state is a useful thing to have for a maintainer, so I might want to raise a feature request at GitHub.
Agreed that it would be a useful operation. Our Pull Requests team is lately working on adding new APIs for things that are currently missing, this included. Therefore, you do not need to file a feature request. However, you do you have to patient, because these things can take weeks/months. Thank you!
Excellent, thank you @mislav !
Most helpful comment
In hub master there is now the
hub issue update <NUMBER>
command #2432 which can update the following fields of an issue or pull request:Updating PR-specific fields such as
base
ordraft
is still unsupported, but is always possible viahub api
: https://github.com/github/hub/issues/2312#issuecomment-544626863