Created
November 2, 2016 21:07
-
-
Save kickscondor/41194f6e45398aaa58291bf7a2074fcd to your computer and use it in GitHub Desktop.
Github Milestones -> Ical
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
machine api.github.com | |
login your-username | |
password your-40-char-token |
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
# ruby ical-of-milestone.rb "Project Name" user0/repo0 user1/repo1 | |
require 'icalendar' | |
require 'octokit' | |
client = Octokit::Client.new :netrc => true | |
milestones = [] | |
ARGV[1..-1].each do |reponame| | |
client.milestones(reponame).each do |m| | |
milestones << m | |
end | |
end | |
cal = Icalendar::Calendar.new | |
milestones. | |
sort_by { |m| m[:due_on] }. | |
each do |m| | |
cal.event do |e| | |
e.url = m[:html_url] | |
e.dtstart = e.dtend = e.dtstamp = m[:due_on] | |
e.created = m[:created] | |
e.last_modified = m[:updated] | |
e.uid = "#{m[:id]}" | |
e.summary = "#{ARGV[0]} #{m[:title]}" | |
e.description = m[:description] | |
e.organizer = "MAILTO:#{m[:creator][:login]}@users.noreply.github.com" | |
end | |
end | |
cal.publish | |
puts cal.to_ical |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment