Sha256: 75eb757ee7cb074e6ceec1f5309ec08b98129dbe47ad2d08d108f36dd0150e5d

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 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
  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

5 entries across 5 versions & 1 rubygems

Version Path
multi_repo-0.2.1 scripts/restart_travis_builds
multi_repo-0.2.0 scripts/restart_travis_builds
multi_repo-0.1.2 scripts/restart_travis_builds
multi_repo-0.1.1 scripts/restart_travis_builds
multi_repo-0.1.0 scripts/restart_travis_builds