Skip to content

Commit

Permalink
Customize Dry Run Group Dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyson Trinh committed Jun 20, 2024
1 parent 26beb2d commit 81a8fbf
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions bin/dry-run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ def security_fix?(dependency)
puts "=> updating #{dependencies.count} dependencies: #{dependencies.map(&:name).join(', ')}"

# rubocop:disable Metrics/BlockLength
my_array_deps = []
my_array_files = []
checker_count = 0
dependencies.each do |dep|
checker_count += 1
Expand Down Expand Up @@ -706,10 +708,14 @@ def security_fix?(dependency)
next
end


# Removal is only supported for transitive dependencies which are removed as a
# side effect of the parent update
deps_to_update = updated_deps.reject(&:removed?)
updater = file_updater_for(deps_to_update)
my_array_deps.push(updated_deps[0])

puts "updated_deps_first => #{deps_to_update}"
updater = file_updater_for(my_array_deps)
updated_files = updater.updated_dependency_files

updated_deps = updated_deps.reject do |d|
Expand All @@ -730,12 +736,19 @@ def security_fix?(dependency)

puts " => #{msg.pr_name.downcase}"


puts "updated_deps => #{updated_deps[0]}"
puts "my_array_deps => #{my_array_deps}"
puts "updated_files => #{updated_files.count}"

# puts "updated_files => #{updated_files}"

assignee = (ENV["PULL_REQUESTS_ASSIGNEE"] || ENV["GITLAB_ASSIGNEE_ID"])&.to_i
assignees = assignee ? [assignee] : assignee
pr_creator = Dependabot::PullRequestCreator.new(
source: $source,
base_commit: $commit,
dependencies: updated_deps,
dependencies: my_array_deps,
files: updated_files,
credentials: $options[:credentials],
assignees: assignees,
Expand All @@ -744,7 +757,7 @@ def security_fix?(dependency)
)
pull_request = pr_creator.create

puts "submitted"
puts " submitted"

if $options[:write]
updated_files.each do |updated_file|
Expand Down Expand Up @@ -791,6 +804,8 @@ def security_fix?(dependency)

puts "馃實 Total requests made: '#{$network_trace_count}'"



# rubocop:enable Metrics/BlockLength

# rubocop:enable Style/GlobalVars

0 comments on commit 81a8fbf

Please sign in to comment.