Class: Dependabot::GithubActions::UpdateChecker

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

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



27
28
29
30
# File 'lib/dependabot/github_actions/update_checker.rb', line 27

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

#latest_resolvable_version_with_no_unlockObject



33
34
35
36
# File 'lib/dependabot/github_actions/update_checker.rb', line 33

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

#latest_versionObject



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

def latest_version
  @latest_version ||= T.let(
    fetch_latest_version,
    T.nilable(T.any(String, Gem::Version))
  )
end

#lowest_resolvable_security_fix_versionObject



47
48
49
50
# File 'lib/dependabot/github_actions/update_checker.rb', line 47

def lowest_resolvable_security_fix_version
  # Resolvability isn't an issue for GitHub Actions.
  lowest_security_fix_version
end

#lowest_security_fix_versionObject



39
40
41
42
43
44
# File 'lib/dependabot/github_actions/update_checker.rb', line 39

def lowest_security_fix_version
  @lowest_security_fix_version ||= T.let(
    fetch_lowest_security_fix_version,
    T.nilable(Dependabot::Version)
  )
end

#updated_requirementsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/dependabot/github_actions/update_checker.rb', line 53

def updated_requirements
  dependency.requirements.map do |req|
    source = req[:source]
    updated = updated_ref(source)
    next req unless updated

    current = source[:ref]

    # Maintain a short git hash only if it matches the latest
    if req[:type] == "git" &&
       git_commit_checker.ref_looks_like_commit_sha?(updated) &&
       git_commit_checker.ref_looks_like_commit_sha?(current) &&
       updated.start_with?(current)
      next req
    end

    new_source = source.merge(ref: updated)
    req.merge(source: new_source)
  end
end