class Bard::CI::GithubActions

Public Instance Methods

console() click to toggle source
# File lib/bard/ci/github_actions.rb, line 26
def console
  @run.console
end
exists?() click to toggle source
# File lib/bard/ci/github_actions.rb, line 22
def exists?
  true
end
run() { |elapsed_time, last_time_elapsed| ... } click to toggle source
# File lib/bard/ci/github_actions.rb, line 7
def run
  last_time_elapsed = api.last_successful_run&.time_elapsed
  @run = api.create_run!(branch)

  start_time = Time.new.to_i
  while @run.building?
    elapsed_time = Time.new.to_i - start_time
    yield elapsed_time, last_time_elapsed
    sleep(2)
    @run = api.find_run(@run.id)
  end

  @run.success?
end
status() click to toggle source
# File lib/bard/ci/github_actions.rb, line 30
def status
  last_run = api.last_run
  if last_run.building?
    "Building..."
  elsif last_run.success?
    "Succeeded!"
  elsif last_run.failure?
    "Failed!\n\n#{last_run.console}"
  else
    raise "Unknown job status: #{last_run.inspect}"
  end
end

Private Instance Methods

api() click to toggle source
# File lib/bard/ci/github_actions.rb, line 45
def api
  @api ||= API.new(project_name)
end