Class: MarkPrReadyJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/mark_pr_ready_job.rb

Overview

Column rule action (§17): take the card's PR out of draft — used by QA-style columns where the work should be formally reviewable on GitHub.

Instance Method Summary collapse

Instance Method Details

#perform(card_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/jobs/mark_pr_ready_job.rb', line 6

def perform(card_id)
  card = Card.find(card_id)
  return if card.pr_url.blank?

  out, status = Open3.capture2e("gh", "pr", "ready", card.pr_url)
  if status.success? || out.downcase.include?("already")
    card.update!(pr_state: "ready")
    card.log!("status_change", text: "PR marked ready for review (out of draft)")
  else
    card.log!("error", text: "Could not mark PR ready: #{out.truncate(200)}")
  end
end