Class: CircleCI::CLI::Command::RetryCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/circleci/cli/command/retry_command.rb

Class Method Summary collapse

Methods inherited from BaseCommand

build_number, project_name, reponame, setup_token, should_be_pretty

Class Method Details

.run(options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/circleci/cli/command/retry_command.rb', line 8

def run(options)
  setup_token
  username, reponame = project_name(options).split('/')
  number = build_number_for(username, reponame, options)

  build = Response::Build.retry(username, reponame, number)

  if build&.username
    say "build #{username}/#{reponame} #{build.build_number} is triggered"
  else
    say "failed to trigger #{username}/#{reponame} #{number}"
  end
end