Sha256: 26de82c01a66fb1c21a162d5618fe70c2631175de5eb0237655646a4575b5db0

Contents?: true

Size: 520 Bytes

Versions: 10

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

module Github
  def labels
    @github_labels ||=
      github.api.labels(repo_name)
  end

  def repo_name
    github.pr_json['base']['repo']['full_name']
  end

  def pr_number
    github.pr_json['number']
  end

  def add_labels(*new_labels)
    existing = labels.map(&:name)
    new_labels.reject { |l| existing.include?(l) }.each do |to_create|
      github.api.add_label(repo_name, to_create)
    end
    github.api.add_labels_to_an_issue(repo_name, pr_number, new_labels)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
danger-wcc-0.1.4 lib/wcc/github.rb
danger-wcc-0.1.3 lib/wcc/github.rb
danger-wcc-0.1.2 lib/wcc/github.rb
danger-wcc-0.1.1 lib/wcc/github.rb
danger-wcc-0.1.0 lib/wcc/github.rb
danger-wcc-0.0.6 lib/wcc/github.rb
danger-wcc-0.0.5 lib/wcc/github.rb
danger-wcc-0.0.4 lib/wcc/github.rb
danger-wcc-0.0.3 lib/wcc/github.rb
danger-wcc-0.0.2 lib/wcc/github.rb