Last active
August 29, 2015 14:27
-
-
Save kylemacey/4e38904dcce6ac74768c to your computer and use it in GitHub Desktop.
Exports all repos for a GHE instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'octokit.rb' | |
# export GITHUB_TOKEN=000000000000000 | |
# export GITHUB_API_ENDPOINT=http://0.0.0.0/api/v3 | |
# export GHE_HOST=0.0.0.0 | |
# export GHE_PROTOCOL=https | |
ACCESS_TOKEN = ENV.fetch("GITHUB_TOKEN") | |
API_ENDPOINT = ENV.fetch("GITHUB_API_ENDPOINT") | |
HOST = ENV.fetch("GHE_HOST") # github.com | |
PROTOCOL = ENV.fetch("GHE_PROTOCOL") # https | |
Octokit.configure do |kit| | |
kit.api_endpoint = API_ENDPOINT | |
kit.access_token = ACCESS_TOKEN | |
kit.auto_paginate = true | |
kit.connection_options = { ssl: { verify: false } } | |
end | |
client = Octokit::Client.new | |
client.organizations.each do |org| | |
client.organization_repositories(org[:login]).each do |repo| | |
puts"#{PROTOCOL}://#{HOST}/#{org[:login]}/#{repo[:name]}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment