Last active
August 29, 2015 14:06
-
-
Save aroben/5b1eaf5318b04183231b to your computer and use it in GitHub Desktop.
Script to generate a histogram of GitHub issue age
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: GITHUB_TOKEN=yourtoken hissuegram.rb owner/repo | |
require "octokit" | |
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"], :auto_paginate => true) | |
issues = client.issues ARGV[0], :state => :open | |
dates = issues.map { |i| i["created_at"] } | |
days_ago = dates.map { |d| ((Time.now - d) / (60 * 60 * 24)).round } | |
buckets = days_ago.group_by { |d| d / 7 }.map { |bucket, contents| [bucket, contents.length] }.sort | |
puts sprintf("%10s %7s", "weeks ago", "count") | |
puts buckets.map { |bucket, count| sprintf("% 10d % 7d %s", bucket, count, "=" * count) }.join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment