Skip to content

Instantly share code, notes, and snippets.

@abhiyerra
Last active January 9, 2019 21:46
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 abhiyerra/b8648357ff0f8b927dfdace987790316 to your computer and use it in GitHub Desktop.
Save abhiyerra/b8648357ff0f8b927dfdace987790316 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "commonmarker"
require "octokit"
repo = ARGV[0]
doc = CommonMarker.render_doc(open(ARGV[1]).read)
outline = Hash.new { "" }
doc.walk do |node|
if node.type == :header and node.header_level == 1
header = node.to_plaintext.strip
n = node.next
n.walk.each { |subnode| outline[header] += subnode.to_commonmark } if n
end
end
client = Octokit::Client.new(:access_token => ENV['GITHUB_AUTH_TOKEN'])
outline.each do |k, v|
client.create_issue(repo, k, v)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment