GitHub API: Repositories Contributed To

后端 未结 10 1730
耶瑟儿~
耶瑟儿~ 2020-12-07 09:45

Is there a way to get access to the data in the “Repositories contributed to” module on GitHub profile pages via the GitHub API? Ideally the entire list, not just the top fi

10条回答
  •  無奈伤痛
    2020-12-07 10:24

    You'll probably get the last year or so via GitHub's GraphQL API, as shown in Bertrand Martel's answer.

    Everything that happened back to 2011 can be found in GitHub Archive, as stated in Kyle Kelley's answer. However, BigQuery's syntax and GitHub's API seems to have changed and the examples shown there no longer work in 08/2020.

    So here's how I found all repos I contributed to

    SELECT distinct repo.name
    FROM (
      SELECT * FROM `githubarchive.year.2011` UNION ALL
      SELECT * FROM `githubarchive.year.2012` UNION ALL
      SELECT * FROM `githubarchive.year.2013` UNION ALL
      SELECT * FROM `githubarchive.year.2014` UNION ALL
      SELECT * FROM `githubarchive.year.2015` UNION ALL
      SELECT * FROM `githubarchive.year.2016` UNION ALL
      SELECT * FROM `githubarchive.year.2017` UNION ALL
      SELECT * FROM `githubarchive.year.2018`
    )
    WHERE (type = 'PushEvent' 
      OR type = 'PullRequestEvent')
      AND actor.login = 'YOUR_USER'
    

    Some of there Repos returned only have a name, no user or org. But I had to process the result manually afterwards anyway.

提交回复
热议问题