Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2015 09:46
What would you like to do?
Produce a Markdown file enumerating the starred repos of a GitHub user (with HTML links) using the Unicorn API gem
# The 'github_api' gem is implicility assumed to have been loaded at this point...
# Configuration data is passed to Github::Client#new as a Hash whose keys are Symbols
user: 'github-username',
login: '',
oauth_token: 'personal-access-token' # one of many valid authentication methods (see the gem docs for more)
# Data is returned from the API as a Github::ResponseWrapper object
starred ='path-to-output-dir/', 'w') do |f|
# By default, entries are dispensed 30-per-call. Thanks to helpers provided in Github::Paginate, the entire
# result set can be collated into a single Array; just call 'auto_paginate' with 'true' as parameter.
starred.auto_paginate(true).each do |r|
f.puts "- [#{r['full_name']}](#{r['html_url']})" # Markdown links are easy to generate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment