Skip to content

Instantly share code, notes, and snippets.

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

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 = => 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
client.list_code_comments(repo).each do |comment|
activity << comment.user.login
non_code ={|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.