Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'bundler'
require 'bundler/setup'
require 'trello'
include Trello
include Trello::Authorization
application_key = ""
application_secret = ""
application_token = ""
Trello::Authorization.const_set :AuthPolicy, OAuthPolicy
OAuthPolicy.consumer_credential = OAuthCredential.new application_key, application_secret
OAuthPolicy.token = OAuthCredential.new application_token, nil
me = Trello::Member.find("me")
board_name = ARGV[0]
version_name = ARGV[1]
file_name = "release_for_#{version_name}.md"
me.boards.each do |board|
if board.name == board_name
board.lists.each do |list|
if list.name == version_name
File.open(file_name, 'w') do |fh|
fh.write("# Release for #{board_name} #{version_name}" + "\n\n")
list.cards.each do |card|
headline = "- #{card.name}"
card.card_labels.map {|label| headline << " [ #{label['name']} ]"}
fh.write("#{headline}\n")
end
end
break
end
end
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment