From dfb0f700019a77a797bb3c34a39c1ebb98f4931b Mon Sep 17 00:00:00 2001 From: Barry Gordon Date: Thu, 11 May 2023 14:22:24 +0100 Subject: [PATCH] Remove prototype from branch names --- .../branch_namer/dependency_group_strategy.rb | 10 ++++++---- common/spec/dependabot/pull_request_creator_spec.rb | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) 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 7a2384615d54..57d23307947c 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 379b3d34c669..0770cfe4f0b4 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,