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



161
162
163
# File 'lib/bard/ci/github_actions.rb', line 161

def branch
  json["head_branch"]
end

#building?Boolean

Returns:

  • (Boolean)


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

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

#conclusionObject



173
174
175
# File 'lib/bard/ci/github_actions.rb', line 173

def conclusion
  json["conclusion"]
end

#consoleObject



157
158
159
# File 'lib/bard/ci/github_actions.rb', line 157

def console
  job.logs
end

#failure?Boolean

Returns:

  • (Boolean)


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

def failure?
  conclusion == "failure"
end

#idObject



132
133
134
# File 'lib/bard/ci/github_actions.rb', line 132

def id
  json["id"]
end

#jobObject



153
154
155
# File 'lib/bard/ci/github_actions.rb', line 153

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

#shaObject



165
166
167
# File 'lib/bard/ci/github_actions.rb', line 165

def sha
  json["head_sha"]
end

#started_atObject



177
178
179
# File 'lib/bard/ci/github_actions.rb', line 177

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

#statusObject



169
170
171
# File 'lib/bard/ci/github_actions.rb', line 169

def status
  json["status"]
end

#success?Boolean

Returns:

  • (Boolean)


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

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

#time_elapsedObject



136
137
138
# File 'lib/bard/ci/github_actions.rb', line 136

def time_elapsed
  job.time_elapsed
end

#updated_atObject



181
182
183
# File 'lib/bard/ci/github_actions.rb', line 181

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