Skip to content

Instantly share code, notes, and snippets.

@mechiland
Created December 2, 2013 08:55
Show Gist options
  • Save mechiland/7746805 to your computer and use it in GitHub Desktop.
Save mechiland/7746805 to your computer and use it in GitHub Desktop.
create github milestones
require 'octokit'
require 'date'
milestones = [
"70: JUL29"
]
start = 92
range = (Date.parse('2014-01-01')...Date.parse('2014-3-31'))
name = "#{start}: "
milestones = []
range.each do |d|
if d.monday?
name = name + d.strftime("%b%d").upcase
end
if d.sunday?
name = name + " - " + d.strftime("%b%d").upcase
milestones << {name: name, due_on: d}
start += 1
name = "#{start}: "
end
end
login, password = ENV["GITHUB"].split(":")
client = Octokit::Client.new login:login, password:password
milestones.each do |m|
client.create_milestone 'thscn/goldendata', m[:name], {due_on: m[:due_on]}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment