recurser / pivotal-to-trello

Pivotal Tracker to Trello exporter
MIT License
30 stars 8 forks source link

Tons of duplicated Labels :( #16

Open danielricecodes opened 6 years ago

danielricecodes commented 6 years ago

Just ran this today - decided to go in blind and didn't try on a test project first. I should have...I have hundreds of duplicated labels now. The import itself seems to run ok, but every Store/Card got a warning about the label not being found...but instead of the migration seemed to create a new label for each story.

screenshot from 2018-08-31 18-36-59

Not sure what caused this, but I just had a plain vanilla Trello board.

danielricecodes commented 6 years ago

If this happens to anyone else, its easy to clean up.

#setup Trello Client - its done inside this class' initializer
PivotalToTrello::TrelloWrapper.new('<YOUR_TRELLO_KEY>', 'YOUR_TRELLO_SECRET')

#Get your Board ID
#Run Trello::Board.all then save the "id" attribute that matches your Board.
board_id = 'FOUND_BOARD_ID'

#create an array of all the label names you wish to remove
labels_to_delete = %w(bug release feature chore)
labels_to_delete.each do |delete_me|
  Trello::Board.find(board_id).labels.select{|l| l.name == delete_me}.each(&:delete)
end

All done. This easily beats manually deleting 700 errant labels.