Skip to content

Instantly share code, notes, and snippets.

@Ghabry
Created February 12, 2019 21:42
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 Ghabry/ee729d03331c4b38bbcceb1af421ee89 to your computer and use it in GitHub Desktop.
Save Ghabry/ee729d03331c4b38bbcceb1af421ee89 to your computer and use it in GitHub Desktop.
easyrpg blog post generator
require "open-uri"
require "json"
j=JSON.parse(open('https://api.github.com/repos/easyrpg/player/issues?milestone=20&state=closed&per_page=100&page=2').read());
jj=JSON.parse(open('https://api.github.com/repos/easyrpg/player/issues?milestone=20&state=closed&per_page=100').read());
j = j + jj
j = j.sort { |x,y| x["number"] <=> y["number"] }
j.each { |x|
x["labels"] = (x["labels"].map { |y| y["name"] }.join("\n"))
}
issues = j.group_by { |x|
x["labels"].include?("Invalid") ? "Invalid" :
x["labels"].include?("Duplicate") ? "Duplicate" :
x["labels"].include?("Event/Interpreter") ? "Event/Interpreter" :
x["labels"].include?("Move Route") ? "Move Route" :
x["labels"].include?("FileFinder") ? "FileFinder" :
x["labels"].include?("Battle") ? "Battle" :
x["labels"].include?("Savegames") ? "Savegames" :
x["labels"].include?("Window/Scenes") ? "Window/Scenes" :
x["labels"].include?("Building") ? "Building" :
"Other"}
["Event/Interpreter", "Move Route", "Battle", "Savegames", "Window/Scenes", "FileFinder", "Building", "Other"].each {|k|
puts "<h3>#{k}</h3>"
issues[k].each { |x|
puts "#{x["html_url"].include?("pull") ? "Pull Request:" : "Issue:"} #{x['title']} (<a href=\"#{x['html_url']}\" title=\"#{x['title']}\">\##{x['number']}</a>)"
puts ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment