Skip to content

Commit

Permalink
Merge pull request #8528 from dependabot/nishnha/include-directory-name
Browse files Browse the repository at this point in the history
Include the directory name in multi-directory PR summaries
  • Loading branch information
Nishnha authored Dec 5, 2023
2 parents 7b3b9b1 + 0b08316 commit 8a7277c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions common/lib/dependabot/pull_request_creator/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def group_pr_name
updates = dependencies.map(&:name).uniq.count

if source&.directories
"bump the #{dependency_group.name} with #{updates} update#{'s' if updates > 1}"
"bump the #{dependency_group.name} across #{source.directories.count} directories " \
"with #{updates} update#{'s' if updates > 1}"
else
"bump the #{dependency_group.name} group#{pr_name_directory} with #{updates} update#{'s' if updates > 1}"
end
Expand Down Expand Up @@ -363,7 +364,7 @@ def multi_directory_group_intro
update_count = dependencies_in_directory.map(&:name).uniq.count

msg += "Bumps the #{dependency_group.name} " \
"with #{update_count} update#{update_count > 1 ? 's' : ''}:"
"with #{update_count} update#{update_count > 1 ? 's' : ''} in the #{directory} directory:"

msg += if update_count >= 5
header = %w(Package From To)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def commits_details(base:, head:)
Dependabot::Source.new(provider: "github", repo: "gocardless/bump", directories: ["/foo", "/bar"])
end
let(:dependency_group) do
Dependabot::DependencyGroup.new(name: "go_modules group across 2 directories", rules: { patterns: ["*"] })
Dependabot::DependencyGroup.new(name: "go_modules group", rules: { patterns: ["*"] })
end

before do
Expand Down Expand Up @@ -2458,7 +2458,7 @@ def commits_details(base:, head:)
Dependabot::Source.new(provider: "github", repo: "gocardless/bump", directories: ["/foo", "/bar"])
end
let(:dependency_group) do
Dependabot::DependencyGroup.new(name: "go_modules group across 2 directories", rules: { patterns: ["*"] })
Dependabot::DependencyGroup.new(name: "go_modules group", rules: { patterns: ["*"] })
end
let(:dependency) do
Dependabot::Dependency.new(
Expand All @@ -2474,7 +2474,7 @@ def commits_details(base:, head:)

it "has the correct message" do
expect(pr_message).to start_with(
"Bumps the go_modules group across 2 directories with 1 update: " \
"Bumps the go_modules group with 1 update in the /foo directory: " \
"[business](https://github.com/gocardless/business)."
)
end
Expand Down Expand Up @@ -2540,7 +2540,7 @@ def commits_details(base:, head:)

it "has the correct message" do
expect(pr_message).to start_with(
"Bumps the go_modules group across 2 directories with 2 updates: " \
"Bumps the go_modules group with 2 updates in the /foo directory: " \
"[business](https://github.com/gocardless/business) and " \
"[business2](https://github.com/gocardless/business2)."
)
Expand Down Expand Up @@ -2602,9 +2602,9 @@ def commits_details(base:, head:)

it "has the correct message" do
expect(pr_message).to start_with(
"Bumps the go_modules group across 2 directories with 1 update: " \
"Bumps the go_modules group with 1 update in the /foo directory: " \
"[business](https://github.com/gocardless/business).\n" \
"Bumps the go_modules group across 2 directories with 1 update: " \
"Bumps the go_modules group with 1 update in the /bar directory: " \
"[business2](https://github.com/gocardless/business2)."
)
end
Expand Down
2 changes: 1 addition & 1 deletion updater/lib/dependabot/updater/security_update_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Updater
module SecurityUpdateHelpers
def grouped_security_update_group(job)
Dependabot::DependencyGroup.new(
name: "#{job.package_manager} group across #{job.source&.directories&.count || 1} directories",
name: "#{job.package_manager} group",
rules: {
"patterns" => "*" # The grouping is more dictated by the dependencies passed in.
}
Expand Down

0 comments on commit 8a7277c

Please sign in to comment.