Class: Bard::CI::GithubActions
- Inherits:
-
Struct
- Object
- Struct
- Bard::CI::GithubActions
- Defined in:
- lib/bard/ci/github_actions.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#sha ⇒ Object
Returns the value of attribute sha.
Instance Method Summary collapse
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch
6 7 8 |
# File 'lib/bard/ci/github_actions.rb', line 6 def branch @branch end |
#project_name ⇒ Object
Returns the value of attribute project_name
6 7 8 |
# File 'lib/bard/ci/github_actions.rb', line 6 def project_name @project_name end |
#sha ⇒ Object
Returns the value of attribute sha
6 7 8 |
# File 'lib/bard/ci/github_actions.rb', line 6 def sha @sha end |
Instance Method Details
#console ⇒ Object
26 27 28 |
# File 'lib/bard/ci/github_actions.rb', line 26 def console @run.console end |
#exists? ⇒ Boolean
22 23 24 |
# File 'lib/bard/ci/github_actions.rb', line 22 def exists? true end |
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 |