Sha256: 37dafef34c4ac4c01041e1f141bbf98ebc31927e1f1307152ef11d3e4a898532

Contents?: true

Size: 1009 Bytes

Versions: 6

Compression:

Stored size: 1009 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/inline"
gemfile do
  source "https://rubygems.org"
  gem "multi_repo", require: "multi_repo/cli", path: File.expand_path("..", __dir__)
end

opts = Optimist.options do
  synopsis "Reenable all disabled workflows in an org."

  opt :org, "The organization to reenable workflows in", :type => :string, :required => true
  opt :extra_repos, "Extra repos to reenable workflows in", :type => :strings, :default => []

  MultiRepo::CLI.common_options(self, :only => :dry_run)
end

github = MultiRepo::Service::Github.new(**opts.slice(:dry_run))

repos = (github.org_repo_names(opts[:org]) + opts[:extra_repos]).sort
repos.each do |repo_name|
  puts MultiRepo::CLI.header(repo_name)

  disabled_workflows = github.disabled_workflows(repo_name)
  if disabled_workflows.any?
    disabled_workflows.each do |w|
      puts "** Enabling #{w.html_url} (#{w.id})"
      github.enable_workflow(repo_name, w.id)
    end
  else
    puts "** No disabled workflows found"
  end

  puts
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
multi_repo-0.5.0 scripts/reenable_repo_workflows
multi_repo-0.4.0 scripts/reenable_repo_workflows
multi_repo-0.3.1 scripts/reenable_repo_workflows
multi_repo-0.3.0 scripts/reenable_repo_workflows
multi_repo-0.2.3 scripts/reenable_repo_workflows
multi_repo-0.2.2 scripts/reenable_repo_workflows