Sha256: a1ca85864807e6bd0d3d327bd4ae7dfe57f444c85ba0d24c500b8ca4cecbc99a

Contents?: true

Size: 986 Bytes

Versions: 6

Compression:

Stored size: 986 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
require 'travis'
require 'travis/pro/auto_login'

opts = Optimist.options do
  synopsis "Restart all Travis builds for a given branch or tag for all GitHub repos."

  opt :ref, "The branch or release tag to rebuild.", :type => :string, :required => true

  MultiRepo::CLI.common_options(self, :except => :dry_run, :repo_set_default => nil)
end
opts[:repo_set] = opts[:ref].split("-").first unless opts[:repo] || opts[:repo_set]

puts "Restarting Travis builds for #{opts[:ref]}:"

MultiRepo::CLI.repos_for(**opts).collect do |repo|
  repo = Travis::Pro::Repository.find(repo.name)
  begin
    last_build = repo.last_on_branch(opts[:ref])
  rescue Travis::Client::NotFound
    # Ignore repo which doesn't have Travis enabled for that branch
    next
  end

  puts "- #{repo.name}..."
  last_build.restart
end

Version data entries

6 entries across 6 versions & 1 rubygems

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