Class: Dependabot::GithubActions::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Defined in:
lib/dependabot/github_actions/update_checker.rb

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



16
17
18
19
# File 'lib/dependabot/github_actions/update_checker.rb', line 16

def latest_resolvable_version
  # Resolvability isn't an issue for GitHub Actions.
  latest_version
end

#latest_resolvable_version_with_no_unlockObject



21
22
23
24
# File 'lib/dependabot/github_actions/update_checker.rb', line 21

def latest_resolvable_version_with_no_unlock
  # No concept of "unlocking" for GitHub Actions (since no lockfile)
  dependency.version
end

#latest_versionObject



12
13
14
# File 'lib/dependabot/github_actions/update_checker.rb', line 12

def latest_version
  @latest_version ||= fetch_latest_version
end

#updated_requirementsObject

rubocop:disable Metrics/PerceivedComplexity



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dependabot/github_actions/update_checker.rb', line 26

def updated_requirements # rubocop:disable Metrics/PerceivedComplexity
  previous = dependency_source_details
  updated = updated_source
  return dependency.requirements if updated == previous

  # Maintain a short git hash only if it matches the latest
  if previous[:type] == "git" &&
     previous[:url] == updated[:url] &&
     updated[:ref]&.match?(/^[0-9a-f]{6,40}$/) &&
     previous[:ref]&.match?(/^[0-9a-f]{6,40}$/) &&
     updated[:ref]&.start_with?(previous[:ref])
    return dependency.requirements
  end

  dependency.requirements.map { |req| req.merge(source: updated) }
end