Using the GH Api how do I tell when a PR was converted from draft and ready for review #24734
-
Its not going to be the same as CreatedAt when the PR is created as a draft. UpdatedAt will change if anything else is changed about the PR. Is there a reliable way to find the date time of when the PR was marked as ready for Review? When trying to figure out the average time to close across PR’s, using CreatedAt isnt going to produce accurate values. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
A Pull Request can switch back and forth between draft and ready to review so there’s no single value that you can rely on. However, because a Pull Request is a type of Issue you could derive this information from the Events history of the Pull Request. The Timeline API is currently in preview so it is subject to change but if you’re comfortable using it during the preview period you could pull the Event history for each Pull Request and find the relevant https://docs.github.com/en/rest/reference/issues#timeline https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#convert_to_draft https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#ready_for_review |
Beta Was this translation helpful? Give feedback.
-
Thanks, the timeline was exactly what I needed |
Beta Was this translation helpful? Give feedback.
-
Hi I am wondering if there is a API to convert a draft pr to ready to review, I tried https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request . This seems not work |
Beta Was this translation helpful? Give feedback.
A Pull Request can switch back and forth between draft and ready to review so there’s no single value that you can rely on. However, because a Pull Request is a type of Issue you could derive this information from the Events history of the Pull Request.
The Timeline API is currently in preview so it is subject to change but if you’re comfortable using it during the preview period you could pull the Event history for each Pull Request and find the relevant
convert_to_draft
orready_for_review
event to determine how you categorise the Pull Request.https://docs.github.com/en/rest/reference/issues#timeline
https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#con…