Getting lastPush time and total commit count on all repos


Hi All,

I am a newbie to graphql github api .
Have been trying to get a query to generate a sorted report of repos by ‘activity’.
Activity would be based on ‘lastPush’ time and total count of commits.

Had the below seem to work perfectly, except that it will not show more than a 1000 records ( due to the limitation on search ) :frowning:

Would appreciate any help on how to make this work or re-write a new one .

query {
rateLimit {
search(query: “archived:false”, type: REPOSITORY, first: 5) {
pageInfo {
edges {
node {
… on Repository {
defaultBranchRef {
target {
… on Commit {
history() {



@tahershaakir See my reply to you over here and let me know if that works/helps. If not, we’ll see if we can come up with another solution!


Thanks for the response Paul that was helpful. Using your suggestion I have modified my code to limit based on date range.
However , if I need to get all repos ( 20K) , then using this way would be not so ideal ie I would need to step through the date range and dynamically alter it and try again if any range gives me more than 1000 until I get all of them.

The other way you have suggested is "organization(login: $orgName) { " . I need to figure out how to get ‘all’ orgs instead of passing each orgname ( for which I think search is needed which has the limitation :frowning: )