Module: Ocak::StepComments
- Included in:
- Commands::Hiz, PipelineExecutor
- Defined in:
- lib/ocak/step_comments.rb
Overview
Shared comment-posting helpers for pipeline steps. Includers must provide an @issues instance variable (IssueFetcher or nil).
Instance Method Summary collapse
- #post_step_comment(issue_number, body) ⇒ Object
- #post_step_completion_comment(issue_number, role, result) ⇒ Object
Instance Method Details
#post_step_comment(issue_number, body) ⇒ Object
7 8 9 10 11 |
# File 'lib/ocak/step_comments.rb', line 7 def post_step_comment(issue_number, body) @issues&.comment(issue_number, body) rescue StandardError nil end |
#post_step_completion_comment(issue_number, role, result) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/ocak/step_comments.rb', line 13 def post_step_completion_comment(issue_number, role, result) duration = (result.duration_ms.to_f / 1000).round cost = format('%.3f', result.cost_usd.to_f) if result.success? post_step_comment(issue_number, "\u{2705} **Phase: #{role}** completed \u2014 #{duration}s | $#{cost}") else post_step_comment(issue_number, "\u{274C} **Phase: #{role}** failed \u2014 #{duration}s | $#{cost}") end end |