Getting github individual file contributors using GraphQL API


#1

The information that I am looking for is the following:

  1. How many times all the code files in the repository have been changed.
  2. Who all contributed to the code file and if possible with the timestamp of the change.
    How can I do that using GraphQL API?

#2
query Stat($repo: String!, $user: String!, $path: String!, $count: Int!, $after: String) {
  repository(owner: $user, name: $repo) {
    ref(qualifiedName: "refs/heads/master") {
      target {
        ... on Commit {
      	  history(first: $count, path: $path, after: $after) {
            nodes {
              author {
                user {
                  login
                }
              }
            }
          }
        }
      }
    }
  }
}

Then in your preferred language loop and collect.