Created
December 18, 2014 21:36
-
-
Save carmstrong/bcca0f38262a5ba4a987 to your computer and use it in GitHub Desktop.
Deis project activity by user
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'csv' | |
require 'octokit' | |
date_since = ARGV.first | |
if date_since.nil? or date_since.empty? | |
date_since = '2013-07-22' | |
end | |
# ignore project maintainers | |
ignored_contributors = %w[bacongobbler carmstrong gabrtv mboersma coveralls deis-admin] | |
# make our GitHub calls here | |
client = Octokit::Client.new(:access_token => ENV['GITHUB_ACCESS_TOKEN'], :auto_paginate => true) | |
issues = client.search_issues("repo:deis/deis created:>#{date_since}", {:per_page => 10000}) | |
comments = client.issues_comments("deis/deis", {:since => date_since, :per_page => 10000}) | |
touchers = {} | |
issues.items.each do |issue| | |
author = issue.user.login.to_s | |
if not ignored_contributors.include?(author) | |
if touchers[author].nil? | |
touchers[author] = 1 | |
else | |
touchers[author] = touchers[author]+1 | |
end | |
end | |
end | |
comments.each do |c| | |
author = c.user.login | |
if not ignored_contributors.include?(author) | |
if touchers[author].nil? | |
touchers[author] = 1 | |
else | |
touchers[author] = touchers[author]+1 | |
end | |
end | |
end | |
CSV.open("users.csv", "wb") do |csv| | |
csv << ["id", "touches", "name", "company", "location", "email"] | |
touchers.each do |id, count| | |
user = client.user(id) | |
csv << [id, count, user.name, user.company, user.location, user.email] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment