Is there a way to find number of commits/pull request/issues on a public repository using GitHub API in the last 24 hours?

Viewed 192
1 Answers

This is probably because the merge commits are not included in Github insights.

For example apache/activemq Insights lists 2 commits on 15th feb 2022.

But if I run the the commit search for the main branch on 15th I get 3 commits (I am using a graphQL for the search).

{
  repository(name: "activemq", owner: "apache") {
    ref(qualifiedName: "main") {
      target {
        ... on Commit {
          history(since: "2022-02-15T00:00:00+00:00", until: "2022-02-16T00:00:00+00:00") {
            totalCount
            nodes{
              authoredDate
              message
            }
          }
        }
      }
    }
  }
}

The result of the above query displays three commits on the 15th. But the second commit is a merge commit and hence not included in the insights.

{
  "data": {
    "repository": {
      "ref": {
        "target": {
          "history": {
            "totalCount": 3,
            "nodes": [
              {
                "authoredDate": "2022-02-15T06:35:30Z",
                "message": "Fix version in SECURITY.md"
              },
              {
                "authoredDate": "2022-02-15T04:38:56Z",
                "message": "Merge pull request #767 from coheigea/coheigea/SECURITY.md\n\nAdding SECURITY.md for ActiveMQ"
              },
              {
                "authoredDate": "2022-02-15T04:34:35Z",
                "message": "Adding SECURITY.md for ActiveMQ"
              }
            ]
          }
        }
      }
    }
  }
}
Related