Created
September 10, 2015 23:27
-
-
Save glasnt/0ae57a62cc86df95c549 to your computer and use it in GitHub Desktop.
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
# Super basic implementation of the octohat concept, but in ruby. | |
# It most probably is missing some elements. | |
require 'octokit' | |
access_token = ENV["GITHUB_TOKEN"] | |
repo = ARGV[0] | |
client = Octokit::Client.new(:access_token => access_token) | |
Octokit.auto_paginate = true | |
contributors = client.contributors(repo).map{|c| c.login} | |
activity = [] | |
client.issues(repo, state: "all").each do |issue| | |
activity << issue.user.login | |
commentors = client.issue_comments(repo, issue.number).map{|comment| comment.user.login}.uniq | |
puts "Issue: #{issue.number} - #{issue.user.login} - #{commentors.join(",")}" | |
activity << commentors | |
end | |
client.list_code_comments(repo).each do |comment| | |
activity << comment.user.login | |
end | |
activity.flatten!.uniq! | |
non_code = activity.select{|a| !contributors.include? a } | |
puts "Code contributions: #{contributors.length}" | |
puts "Non-code contributions: #{non_code.length}" | |
puts non_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment