Skip to content

Instantly share code, notes, and snippets.

@kickscondor
Created November 2, 2016 21:07
Show Gist options
  • Save kickscondor/41194f6e45398aaa58291bf7a2074fcd to your computer and use it in GitHub Desktop.
Save kickscondor/41194f6e45398aaa58291bf7a2074fcd to your computer and use it in GitHub Desktop.
Github Milestones -> Ical
machine api.github.com
login your-username
password your-40-char-token
# 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