Class: Dependabot::GithubActions::FileUpdater

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



16
17
18
19
20
21
22
23
24
# File 'lib/dependabot/github_actions/file_updater.rb', line 16

def self.updated_files_regex
  [
    # Matches .yml or .yaml files in the .github/workflows directories
    %r{\.github/workflows/.+\.ya?ml$},

    # Matches .yml or .yaml files in the root directory or any subdirectory
    %r{(?:^|/).+\.ya?ml$}
  ]
end

Instance Method Details

#updated_dependency_filesObject



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

def updated_dependency_files
  updated_files = []

  dependency_files.each do |file|
    next unless requirement_changed?(file, dependency)

    updated_files <<
      updated_file(
        file: file,
        content: updated_workflow_file_content(file)
      )
  end

  updated_files.reject! { |f| dependency_files.include?(f) }
  raise "No files changed!" if updated_files.none?

  updated_files
end