Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save regularlady/3f25cd013f79a3c3252b79d281e2b0c4 to your computer and use it in GitHub Desktop.
Save regularlady/3f25cd013f79a3c3252b79d281e2b0c4 to your computer and use it in GitHub Desktop.
Octokit Public and Private Repositories
github_auth = Octokit::Client.new(access_token: current_user.token, per_page: 100, auto_paginate: true)
# public repositories
repositories = github_auth.repos || []
# loop through each org and collect repositories
github_auth.orgs.each do |org|
private_repositories = github_auth.org_repos(org[:login], {:type => 'private'})
private_repositories.each do |repository|
repositories << repository
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment