-
Notifications
You must be signed in to change notification settings - Fork 315
Open
Description
Hello, I'm unsure if this is user error (most likely) but I'm having issues including private repositories in the results of a repos.list
call. I've tried using different scopes in the generated Personal access token, including adding one with all permissions enabled, but i am still unable to list private repositories.
require 'github_api'
username = 'deanwilson'
private_repo = 'private-test-repo_name'
config = {
auto_pagination: true,
oauth_token: ENV['GITHUB_TOKEN'],
user: username
}
github = Github.new config
# get the private repo directly
foo = github.repos.get user: username, repo: private_repo
puts "Is #{private_repo} private? #{foo.private}"
# list _all_ repos
repos = github.repos.list
puts "Looking through #{repos.length} repos"
names = repos.map {|r| r.name }
if names.include? private_repo
puts "Found private repo in list"
else
puts "Didn't find private repo in list"
end
private_repos = repos.select {|r| r.private }
puts "Found #{private_repos.length} private repos"
__END__
bundle exec ruby lister
Is private-test-repo private? true
Looking through 87 repos
Didn't find private repo in list
Found 0 private repos
This is an individual github user but it is also assicatyed with a small number of orgs. I am only attempting to list the users own repos.
Any advice on this would be appreciated.
Thank you for your time.
Metadata
Metadata
Assignees
Labels
No labels