DesignOpen / board

A board of open projects searching for designers.
9 stars 1 forks source link

Add organization repositories to project selection #42

Open kimmobrunfeldt opened 9 years ago

kimmobrunfeldt commented 9 years ago

GitHub API returns only personal repositories. It should return organization repositories too nowadays.

una commented 9 years ago

@lauweijie may have an idea of how to fix this -- The Design Guidelines board solves this https://github.com/DesignOpen/design-guidelines-board

lauweijie commented 9 years ago

Multiple API calls are required to list all organization repositories.

  1. Get all organizations associated with user
  2. For each organizaion, get all repositories with write privileges

This might take awhile to enumerate if the user has many organizations -- which was why I decided to load only personal repos and the list of organizations first. Organization's repos are fetched only when requested.

Caching could also help to reduce the number of API calls made to GitHub.

kimmobrunfeldt commented 9 years ago

I was hoping to not have to do that. https://developer.github.com/v3/repos/#list-user-repositories they say in the api docs that:

With the new Organization Permissions API (described below), this will include repositories owned by organizations which the user can access. If you provide the custom media type (described below), you won’t need to use other APIs to list the authenticated user’s organization-owned repositories.

kimmobrunfeldt commented 9 years ago

I was wondering if this behavior is also possible when fetching repos for arbitrary user. I tried the custom Access header they guide to, but no luck. I think the migration period has already ended anywsy so no need for custom header