Skip to content

Instantly share code, notes, and snippets.

@tylerpearson
Last active January 11, 2022 15:27

Revisions

  1. tylerpearson renamed this gist Oct 11, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. tylerpearson revised this gist Oct 11, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions copy_labels_between_repos.rb
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    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/start"
    COPY_TO_REPO = "repo/end"
    COPY_FROM_REPO = "repo/old"
    COPY_TO_REPO = "repo/new"

    current_labels = client.labels(COPY_FROM_REPO)

  3. tylerpearson revised this gist Oct 11, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion copy_labels_between_repos.rb
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,9 @@
    current_labels = client.labels(COPY_FROM_REPO)

    current_labels.each do |label|
    puts "Adding #{label.name} - ##{label.color}"
    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
  4. tylerpearson created this gist Oct 11, 2014.
    17 changes: 17 additions & 0 deletions copy_labels_between_repos.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    require 'octokit'

    client = Octokit::Client.new(:access_token => "getmefromgithub")

    COPY_FROM_REPO = "repo/start"
    COPY_TO_REPO = "repo/end"

    current_labels = client.labels(COPY_FROM_REPO)

    current_labels.each do |label|
    puts "Adding #{label.name} - ##{label.color}"
    begin
    client.add_label(COPY_TO_REPO, label.name, label.color)
    rescue Exception => e
    puts "#{label.name} already exists" if e.class == Octokit::UnprocessableEntity
    end
    end