Module: Geet::Helpers::ServicesWorkflowHelper

Extended by:
T::Sig
Includes:
Kernel
Included in:
Services::CommentPr, Services::MergePr, Services::OpenPr
Defined in:
lib/geet/helpers/services_workflow_helper.rb

Overview

Helper for services common workflow, for example, find the merge head.

Instance Method Summary collapse

Instance Method Details

#checked_find_branch_prObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/geet/helpers/services_workflow_helper.rb', line 28

def checked_find_branch_pr
  owner = if @repository.upstream?
    @repository.authenticated_user.username
  else
    @git_client.owner
  end

  head = @git_client.current_branch

  @out.puts "Finding PR with head (#{owner}:#{head})..."

  prs = @repository.prs(owner:, head:)

  raise "Expected to find only one PR for the current branch; found: #{prs.size}" if prs.size != 1

  T.must(prs[0])
end

#initializeObject



17
18
19
20
21
# File 'lib/geet/helpers/services_workflow_helper.rb', line 17

def initialize
  @repository = T.let(T.unsafe(nil), Git::Repository)
  @git_client = T.let(T.unsafe(nil), Utils::GitClient)
  @out = T.let(T.unsafe(nil), IO)
end