diff --git a/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb b/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb index 7a2384615d5..57d23307947 100644 --- a/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb +++ b/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb @@ -21,7 +21,7 @@ def initialize(dependencies:, files:, target_branch:, dependency_group:, # fixed-length name, so we can punt on handling truncation until # we determine the strict validation rules for names def new_branch_name - File.join(prefixes, dependency_group.name, prototype_suffix).gsub("/", separator) + File.join(prefixes, timestamped_group_name).gsub("/", separator) end private @@ -37,9 +37,11 @@ def prefixes ].compact end - # FIXME: Remove once grouped PRs can supersede each other - def prototype_suffix - "prototype-#{Time.now.utc.to_i}" + # When superseding a grouped update pull request, we will have a period + # of time when there are two branches for the group so we use a timestamp + # to avoid collisions. + def timestamped_group_name + "#{dependency_group.name}-#{Time.now.utc.to_i}" end def package_manager diff --git a/common/spec/dependabot/pull_request_creator_spec.rb b/common/spec/dependabot/pull_request_creator_spec.rb index 379b3d34c66..0770cfe4f0b 100644 --- a/common/spec/dependabot/pull_request_creator_spec.rb +++ b/common/spec/dependabot/pull_request_creator_spec.rb @@ -384,7 +384,7 @@ to receive(:new). with( source: source, - branch_name: start_with("dependabot/bundler/all-the-things/prototype-"), + branch_name: start_with("dependabot/bundler/all-the-things-"), base_commit: base_commit, credentials: credentials, files: files,