Get the time a commit was pushed?

Using this API I can list the commits on a Pull Request:

As far as I understand, the and fields are the time the user ran git commit locally and not when they did the git push which caused the Pull Request to update.

However when I look at a Pull Request on GItHub I can see information on push times:

Is there some way to get this information via the API to reconstruct the PR timeline from the perspective of the reviewer?

It’s available from the repository’s events api:

You might be able to find an equivalent in GraphQL as well:

Thanks! Can the events API be queried by event type or filtered in any meaningful way? It doesn’t seem efficient to page through all repo events until I find the particular SHA I am looking for.

Dunno. In general if you want filtering you’re supposed to use GraphQL.

I’m not a GraphQL expert. It’s sometimes powerful, although its power varies significantly depending on how the APIs are written.

I practice, I’m definitely a pessimist.

If I were you, I’d contact:

And describe what you’re trying to do, having looked through both APIs and determined that they do not have an efficient way of retrieving the necessary information (obviously you get to do this step first).

Doesn’t look like this is possible in the REST API but it is possible using GQL, for example:

      repository(owner: "firebase", name: "firebase-tools") {
        pullRequest(number: 3544) {
          timelineItems(last: 250, itemTypes: [PULL_REQUEST_COMMIT]) {
            nodes {
              ... on PullRequestCommit {
                commit {

pushedDate will be null in the case where the PR is from a fork, it looks like that information is just not available in that case.

A given commit can be pushed to multiple (related) repositories at different time points.

Since a PR from a related PR likely contains a commit that has yet to be pushed into your repository, it’s correct to have a null pushedDate from your repository’s perspective.

If you asked the repository where the commit id does exist, GitHub should be able to tell you when it was pushed into that repository.

Ah I see, thanks! That gets a bit tricky with permissions I assume but good to know.

I don’t think you’ll run into permissions. If a repository is in your fork network, then you can see it, and if you can see it, then I’m pretty sure you can see when the commit was pushed.

I could be wrong.

You will of course have to pay for extra API hits. But you could construct a GQL query that combines a bunch of those lookups.