Class: Bard::CLI::CI::GithubActions

Inherits:
Struct
  • Object
show all
Defined in:
lib/bard/ci/github_actions.rb

Defined Under Namespace

Classes: API, Client, Job, Run

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branchObject

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



8
9
10
# File 'lib/bard/ci/github_actions.rb', line 8

def branch
  @branch
end

#project_nameObject

Returns the value of attribute project_name

Returns:

  • (Object)

    the current value of project_name



8
9
10
# File 'lib/bard/ci/github_actions.rb', line 8

def project_name
  @project_name
end

#shaObject

Returns the value of attribute sha

Returns:

  • (Object)

    the current value of sha



8
9
10
# File 'lib/bard/ci/github_actions.rb', line 8

def sha
  @sha
end

Instance Method Details

#consoleObject



29
30
31
# File 'lib/bard/ci/github_actions.rb', line 29

def console
  @run.console
end

#exists?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/bard/ci/github_actions.rb', line 25

def exists?
  true
end

#last_responseObject



33
34
# File 'lib/bard/ci/github_actions.rb', line 33

def last_response
end

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bard/ci/github_actions.rb', line 9

def run
  api = API.new(project_name)
  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