Skip to content

Instantly share code, notes, and snippets.

@freddyb2
Last active February 18, 2020 15:25
Show Gist options
  • Save freddyb2/c3b75c7ec808bae1277dcccf9b48588f to your computer and use it in GitHub Desktop.
Save freddyb2/c3b75c7ec808bae1277dcccf9b48588f to your computer and use it in GitHub Desktop.
Stootie repo URLS
require 'rest-client'
require 'json'
########## EDIT HERE ##########
GITHUB_ORGANISATION = 'stootie'
PAGE_NUMBER = 1
GITHUB_TOKEN = 'TODO'
###############################
GITHUB_API_REPOS = "https://api.github.com/orgs/#{GITHUB_ORGANISATION}/repos?page=#{PAGE_NUMBER}"
response = RestClient.get(GITHUB_API_REPOS, {params: {access_token: GITHUB_TOKEN}}).body
repos_urls = JSON.parse(response)
.select { |repo| !repo['archived'] }
.map { |repo| repo['ssh_url'] }
.map { |url| "git clone #{url}" }
puts repos_urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment