Skip to content

Instantly share code, notes, and snippets.

@pedro
Last active December 30, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedro/7763033 to your computer and use it in GitHub Desktop.
Save pedro/7763033 to your computer and use it in GitHub Desktop.
require "rubygems"
require "octokit"
# get an access token at https://github.com/settings/tokens/new
token = ENV["TOKEN"] || abort("missing TOKEN")
repo = ENV["REPO"] || abort("missing REPO. eg: pedro/devdigest")
client = Octokit::Client.new access_token: token
stats = Hash.new(0)
client.pulls(repo, "closed", per_page: 50).each do |pull|
files = client.pull_request_files(repo, pull.number)
stats[:total] += 1
if files.any? { |f| f.filename =~ /^(app|lib|test|spec|vendor)/ }
stats[:relevant] += 1
if files.any? { |f| f.filename =~ /^(test|spec|vendor\/core\/spec)/ }
stats[:tested] += 1
else
puts "bad: https://github.com/#{repo}/issues/#{pull.number}"
end
end
end
puts stats.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment