require 'octokit' # https://help.github.com/articles/creating-an-access-token-for-command-line-use/ client = Octokit::Client.new(:access_token => "getmefromgithub") COPY_FROM_REPO = "repo/old" COPY_TO_REPO = "repo/new" current_labels = client.labels(COPY_FROM_REPO) current_labels.each do |label| begin client.add_label(COPY_TO_REPO, label.name, label.color) puts "Added #{label.name} - ##{label.color}" rescue Exception => e puts "#{label.name} already exists" if e.class == Octokit::UnprocessableEntity end end