From 01ec2b68027b17ce32f5e7e9860433cccc133e25 Mon Sep 17 00:00:00 2001 From: Michael Henriksen Date: Sat, 19 Mar 2016 14:26:52 +0100 Subject: [PATCH] Fix bug causing private organization repositories to not be collected --- CHANGELOG.md | 1 + lib/gitrob/github/data_manager.rb | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bbd934..da5a71a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). on GitHub API clients. - Setting GitHub access tokens with `--access-tokens` command option resulted in an error. + - Analyze command did not collect private repositories from organizations. ## [1.0.0] ### Added diff --git a/lib/gitrob/github/data_manager.rb b/lib/gitrob/github/data_manager.rb index 34e982c..d33fc4b 100644 --- a/lib/gitrob/github/data_manager.rb +++ b/lib/gitrob/github/data_manager.rb @@ -82,9 +82,15 @@ module Gitrob end def get_repositories(owner) - github_client do |client| - client.repos.list( - :user => owner["login"]).reject { |r| r["fork"] } + if owner["type"] == "Organization" + github_client do |client| + client.repos.list(:org => owner["login"], :type => "sources") + end + else + github_client do |client| + client.repos.list( + :user => owner["login"]).reject { |r| r["fork"] } + end end end