Created
May 13, 2017 16:37
-
-
Save Daniel-Worrall/d37e5967c69fd27a9a9f23e73fd758fc to your computer and use it in GitHub Desktop.
Get list of user locations from github star list in Ruby
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 "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