Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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