github-modules / cool-story-repo

😎Find out a lot about a GitHub repo (or many repos) with a single request to GitHub's GraphQL API
2 stars 0 forks source link

Collect repo's first commit #5

Open zeke opened 6 years ago

zeke commented 6 years ago

Many repos are forked from another repo, then dissociated from the source repo by the person who forked. Unfortunately, the GitHub API will report these as non-forks.

One way to detect these "post-fork" repositories is to collect the SHA of their first commit. When looking at a collection of repos with a common first commit SHA, the repo with the oldest creation data is identifiable as the source.

echjordan commented 6 years ago

From https://platform.github.community/t/something-went-wrong-with-your-query-new-error-code/5145/9

We don’t support back-pagination on the Commit history connection without a before argument for performance reasons. That means in a big repository, you can’t find the first commit without making {number of commits}/100 queries.

We’re looking into better ways to address this use-case, but for now, you could create a ref pointing at the initial commit and use the Repository.ref field