Sha256: b65603ca6a1975f8479b330636f0cafe4c906289bb21f3a4aaded2614ce035e2
Contents?: true
Size: 1.01 KB
Versions: 11
Compression:
Stored size: 1.01 KB
Contents
module MultiRepo::Helpers class UpdateLabels attr_reader :repo_name, :expected_labels, :github def initialize(repo_name, dry_run: false, **) @repo_name = repo_name @expected_labels = MultiRepo::Labels[repo_name] @github = MultiRepo::Service::Github.new(dry_run: dry_run) end def run if expected_labels.nil? puts "!! No labels defined for #{repo_name}" return end expected_labels.each do |label, color| github_label = existing_labels.detect { |l| l.name == label } if !github_label puts "Creating #{label.inspect} with #{color.inspect}" github.create_label(repo_name, label, color) elsif github_label.color.downcase != color.downcase puts "Updating #{label.inspect} to #{color.inspect}" github.update_label(repo_name, label, color: color) end end end private def existing_labels @existing_labels ||= github.client.labels(repo_name) end end end
Version data entries
11 entries across 11 versions & 1 rubygems