Class: Bard::CI::GithubActions::Run

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

Instance Method Summary collapse

Instance Method Details

#branchObject



130
131
132
# File 'lib/bard/ci/github_actions.rb', line 130

def branch
  json["head_branch"]
end

#building?Boolean

Returns:

  • (Boolean)


109
110
111
112
# File 'lib/bard/ci/github_actions.rb', line 109

def building?
  %w[in_progress queued requested waiting pending]
    .include?(json["status"])
end

#conclusionObject



142
143
144
# File 'lib/bard/ci/github_actions.rb', line 142

def conclusion
  json["conclusion"]
end

#consoleObject



126
127
128
# File 'lib/bard/ci/github_actions.rb', line 126

def console
  job.logs
end

#failure?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/bard/ci/github_actions.rb', line 118

def failure?
  conclusion == "failure"
end

#idObject



101
102
103
# File 'lib/bard/ci/github_actions.rb', line 101

def id
  json["id"]
end

#jobObject



122
123
124
# File 'lib/bard/ci/github_actions.rb', line 122

def job
  @job ||= api.find_job_by_run_id(id)
end

#shaObject



134
135
136
# File 'lib/bard/ci/github_actions.rb', line 134

def sha
  json["head_sha"]
end

#started_atObject



146
147
148
# File 'lib/bard/ci/github_actions.rb', line 146

def started_at
  Time.parse(json["run_started_at"])
end

#statusObject



138
139
140
# File 'lib/bard/ci/github_actions.rb', line 138

def status
  json["status"]
end

#success?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/bard/ci/github_actions.rb', line 114

def success?
  status == "completed" && conclusion == "success"
end

#time_elapsedObject



105
106
107
# File 'lib/bard/ci/github_actions.rb', line 105

def time_elapsed
  job.time_elapsed
end

#updated_atObject



150
151
152
# File 'lib/bard/ci/github_actions.rb', line 150

def updated_at
  Time.parse(json["updated_at"])
end