Skip to content

Instantly share code, notes, and snippets.

@jakobw
Created January 2, 2016 16:49
Show Gist options
  • Save jakobw/83f61dab211b61dbc358 to your computer and use it in GitHub Desktop.
Save jakobw/83f61dab211b61dbc358 to your computer and use it in GitHub Desktop.
require 'github_api'
github = Github.new
prs = github.pull_requests(user: 'Zarel', repo: 'Pokemon-Showdown')
.all(state: 'all', per_page: 100)
.auto_paginate(true)
known_authors = []
rejected = 0
multi_pr = []
time_to_merge = []
prs.each do |pr|
if pr.merged_at
time_to_merge << (DateTime.parse(pr.merged_at).to_time - DateTime.parse(pr.created_at).to_time) / 3600
end
if known_authors.include?(pr.user.login)
multi_pr << pr.user.login
next
end
known_authors << pr.user.login
rejected += 1 unless pr.merged_at
end
avg_ttm = time_to_merge.reduce(&:+) / 1529.0
puts "All authors: #{known_authors.length}"
puts "Rejected: #{rejected}"
puts "Accepted: #{known_authors.length - rejected}"
puts "Multiple PR: #{multi_pr.uniq.length}"
puts "First time avg hours to merge: #{avg_ttm}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment