Skip to content

Instantly share code, notes, and snippets.

@glasnt glasnt/octohat.rb
Created Sep 10, 2015

Embed
What would you like to do?
# 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
You can’t perform that action at this time.