Class: Dependabot::PullRequestUpdater::Gitlab

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/pull_request_updater/gitlab.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, base_commit:, old_commit:, files:, credentials:, pull_request_number:) ⇒ Gitlab

Returns a new instance of Gitlab.


13
14
15
16
17
18
19
20
21
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 13

def initialize(source:, base_commit:, old_commit:, files:,
               credentials:, pull_request_number:)
  @source              = source
  @base_commit         = base_commit
  @old_commit          = old_commit
  @files               = files
  @credentials         = credentials
  @pull_request_number = pull_request_number
end

Instance Attribute Details

#base_commitObject (readonly)

Returns the value of attribute base_commit.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def base_commit
  @base_commit
end

#credentialsObject (readonly)

Returns the value of attribute credentials.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def credentials
  @credentials
end

#filesObject (readonly)

Returns the value of attribute files.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def files
  @files
end

#old_commitObject (readonly)

Returns the value of attribute old_commit.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def old_commit
  @old_commit
end

#pull_request_numberObject (readonly)

Returns the value of attribute pull_request_number.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def pull_request_number
  @pull_request_number
end

#sourceObject (readonly)

Returns the value of attribute source.


10
11
12
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 10

def source
  @source
end

Instance Method Details

#updateObject


23
24
25
26
27
28
29
# File 'lib/dependabot/pull_request_updater/gitlab.rb', line 23

def update
  return unless merge_request_exists?
  return unless branch_exists?(merge_request.source_branch)

  create_commit
  merge_request.source_branch
end