Last active
January 9, 2019 21:46
-
-
Save abhiyerra/b8648357ff0f8b927dfdace987790316 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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