Fix bug causing private organization repositories to not be collected

This commit is contained in:
Michael Henriksen
2016-03-19 14:26:52 +01:00
parent f72a2c57b7
commit 01ec2b6802
2 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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