Skip to content

Instantly share code, notes, and snippets.

@capotej
Created January 9, 2014 23:24
Show Gist options
  • Save capotej/8344092 to your computer and use it in GitHub Desktop.
Save capotej/8344092 to your computer and use it in GitHub Desktop.
Script to convert issues/milestones into roadmap
#!/usr/bin/env ruby
# encoding: UTF-8
# Converts Issues and Milestones into roadmap.md
require 'net/http'
require 'json'
require 'open-uri'
require 'pp'
response = open("https://api.github.com/repos/twitter/finatra/issues").read
open_issues = JSON.parse(response)
response = open("https://api.github.com/repos/twitter/finatra/issues?state=closed").read
closed_issues = JSON.parse(response)
# release => [issues]
roadmap = {}
(open_issues + closed_issues).each do |issue|
if issue["milestone"]
release = { "title" => issue["milestone"]["title"], "id" => issue["milestone"]["id"] }
roadmap[release] ||= []
roadmap[release] << { "title" => issue["title"], "url" => issue["html_url"], "state" => issue["state"] }
end
end
File.open("roadmap.md", "w") do |file|
file.puts "---"
file.puts "title: Roadmap - Finatra"
file.puts "layout: finatra"
file.puts "---"
file.puts '<div class="page-header">'
file.puts '<h1>Roadmap</h1>'
file.puts '</div>'
roadmap.sort_by { |r,i| r["id"].to_i }.reverse.each do |release, issues|
file.puts "## #{release["title"]}"
file.puts
issues.each do |issue|
if issue["state"] == "closed"
file.puts " * [#{issue["title"]}](#{issue["url"]}) ✓"
else
file.puts " * [#{issue["title"]}](#{issue["url"]}) ✗"
end
end
file.puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment