Class: ReleaseCeremony::WorkflowFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/release_ceremony/workflow_finder.rb

Overview

Polls GitHub Actions for the workflow run triggered by pushing the release tag, returning its run ID once it appears.

Constant Summary collapse

POLL_ATTEMPTS =
12
POLL_INTERVAL =
5

Instance Method Summary collapse

Constructor Details

#initialize(version:, runner:, sha:, workflow_file:) ⇒ WorkflowFinder

Returns a new instance of WorkflowFinder.



13
14
15
16
17
18
# File 'lib/release_ceremony/workflow_finder.rb', line 13

def initialize(version:, runner:, sha:, workflow_file:)
  @version = version
  @runner = runner
  @sha = sha
  @workflow_file = workflow_file
end

Instance Method Details

#callObject

Raises:



20
21
22
23
24
25
26
27
28
# File 'lib/release_ceremony/workflow_finder.rb', line 20

def call
  POLL_ATTEMPTS.times do
    run_id = workflow_run_id(runner.capture(*command))
    return run_id if run_id

    runner.sleep(POLL_INTERVAL)
  end
  raise Error, "Release workflow did not appear for #{sha} after 60 seconds"
end