Skip to content

Commit

Permalink
Merge pull request dependabot#7297 from dependabot/brrygrdn/remove-pr…
Browse files Browse the repository at this point in the history
…ototype-from-branch-names

[Grouped Updates] Remove prototype from branch names
  • Loading branch information
brrygrdn committed May 12, 2023
2 parents 7445511 + ece1c80 commit b686cdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/spec/dependabot/pull_request_creator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b686cdd

Please sign in to comment.