Page MenuHomeDevCentral

Get the list of the repositories for a GitHub organization
Closed, ResolvedPublic

Description

We need a script to output the list of repositories a specific organization have on GitHub. That would help to clone them all, which is required by code indexers services.

Etsy Hound would be happy with URL like:

[
  "https://www.github.com/Organization/RepoOne.git",
  "https://www.github.com/Organization/RepoTwo.git",
  "https://www.github.com/Organization/RepoThreee.git"
]

Event Timeline

dereckson raised the priority of this task from to Normal.
dereckson updated the task description. (Show Details)
dereckson added subscribers: xcombelle, dereckson.

That should be easy done with the github api. No problem to do it in python3 ?

Yup, Python 3 is totally fine.


API url noted by xcombelle on IRC: https://api.github.com/orgs/$org/repos?page=$page, pages starting at 1, ending at ...

jq selection: jq .[].<property> where property could be clone_url, full_name or name.

Working example

$ curl 'https://api.github.com/orgs/wikimedia/repos?page=1' | jq '.[].name'
"wikipedia-iphone"
"WikipediaMobile"
"WiktionaryMobile"
"limn"
"WLMMobile"
"WikipediaMobileJ2ME"
"jquery-tipsy"
"incubator-cordova-js"
"incubator-cordova-android"
"incubator-cordova-ios"
"jquery.i18n"
"jquery.webfonts"
"jquery.ime"
"jquery.uls"
"puppet-cdh"
"limnpy"
"sqoopy"
"WikisourceMobile"
"puppet-kafka-0.7.2"
"android-commons"
"mediawiki"
"mediawiki-extensions"
"mediawiki-extensions-AJAXPoll"
"mediawiki-extensions-APC"
"mediawiki-extensions-AbsenteeLandlord"
"mediawiki-extensions-AbuseFilter"
"mediawiki-extensions-AccessControl"
"mediawiki-extensions-ActiveAbstract"
"mediawiki-extensions-AdManager"
"mediawiki-extensions-AddThis"
dereckson added a project: User-Dereckson.

I'd like to test Hound so I need that one this evening.