Skip to content

Instantly share code, notes, and snippets.

@Daniel-Worrall
Created May 13, 2017 16:37
Show Gist options
  • Save Daniel-Worrall/d37e5967c69fd27a9a9f23e73fd758fc to your computer and use it in GitHub Desktop.
Save Daniel-Worrall/d37e5967c69fd27a9a9f23e73fd758fc to your computer and use it in GitHub Desktop.
Get list of user locations from github star list in Ruby
require "github_api"
require "csv"
github = Github.new basic_auth: 'login:password'
users = github.activity.starring.list(user: 'username', repo: 'repo', auto_pagination: true)
CSV.open("users.csv", "wb") do |csv|
csv << ["User", "Location"]
users.each { |user| csv << [user.login, github.search.legacy.users(user.login).body.users[0].location] }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment