Class: Dependabot::PullRequestCreator::Bitbucket

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/pull_request_creator/bitbucket.rb

Constant Summary collapse

PR_DESCRIPTION_MAX_LENGTH =

BitBucket Cloud accepts > 1MB characters, but they display poorly in the UI, so limiting to 4x 65,536

262_143

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, branch_name:, base_commit:, credentials:, files:, commit_message:, pr_description:, pr_name:, author_details:, labeler: nil, work_item: nil) ⇒ Bitbucket

0 based count



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 17

def initialize(source:, branch_name:, base_commit:, credentials:,
               files:, commit_message:, pr_description:, pr_name:,
               author_details:, labeler: nil, work_item: nil)
  @source         = source
  @branch_name    = branch_name
  @base_commit    = base_commit
  @credentials    = credentials
  @files          = files
  @commit_message = commit_message
  @pr_description = pr_description
  @pr_name        = pr_name
  @author_details = author_details
  @labeler        = labeler
  @work_item      = work_item
end

Instance Attribute Details

#author_detailsObject (readonly)

Returns the value of attribute author_details.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def author_details
  @author_details
end

#base_commitObject (readonly)

Returns the value of attribute base_commit.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def base_commit
  @base_commit
end

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def branch_name
  @branch_name
end

#commit_messageObject (readonly)

Returns the value of attribute commit_message.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def commit_message
  @commit_message
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def credentials
  @credentials
end

#filesObject (readonly)

Returns the value of attribute files.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def files
  @files
end

#labelerObject (readonly)

Returns the value of attribute labeler.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def labeler
  @labeler
end

#pr_descriptionObject (readonly)

Returns the value of attribute pr_description.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def pr_description
  @pr_description
end

#pr_nameObject (readonly)

Returns the value of attribute pr_name.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def pr_name
  @pr_name
end

#sourceObject (readonly)

Returns the value of attribute source.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def source
  @source
end

#work_itemObject (readonly)

Returns the value of attribute work_item.



10
11
12
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 10

def work_item
  @work_item
end

Instance Method Details

#createObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/dependabot/pull_request_creator/bitbucket.rb', line 33

def create
  return if branch_exists? && pull_request_exists?

  # FIXME: Copied from Azure, but not verified whether this is true
  # For Bitbucket we create or update a branch in the same request as creating
  # a commit (so we don't need create or update branch logic here)
  create_commit

  create_pull_request
end