Using the GH Api how do I tell when a PR was converted from draft and ready for review

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.

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 or ready_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#convert_to_draft

https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#ready_for_review

Thanks, the timeline was exactly what I needed