Skip to content

Commit

Permalink
bump: skip PR checking when livecheck fails
Browse files Browse the repository at this point in the history
`brew bump` will check for PRs related to a package even if livecheck
fails to identify new versions. This reworks related conditions to
ensure that related PR checks are only run when livecheck returns
version information.
  • Loading branch information
samford committed Nov 25, 2024
1 parent 918206e commit 1cbcc44
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Library/Homebrew/dev-cmd/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,17 @@ def retrieve_versions_by_arch(formula_or_cask:, repositories:, name:)
new_version = BumpVersionParser.new(general: "unable to get versions")
end

# We use the arm version for the pull request version. This is consistent
# with the behavior of bump-cask-pr.
pull_request_version = if multiple_versions && new_version.general != "unable to get versions"
new_version.arm.to_s
else
new_version.general.to_s
end
if !args.no_pull_requests? &&
(new_version.general != "unable to get versions") &&
(new_version != current_version)

Check warning on line 371 in Library/Homebrew/dev-cmd/bump.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/bump.rb#L370-L371

Added lines #L370 - L371 were not covered by tests
# We use the ARM version for the pull request version. This is
# consistent with the behavior of bump-cask-pr.
pull_request_version = if multiple_versions
new_version.arm.to_s
else
new_version.general.to_s
end

if !args.no_pull_requests? && (new_version != current_version)
duplicate_pull_requests = retrieve_pull_requests(

Check warning on line 380 in Library/Homebrew/dev-cmd/bump.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/bump.rb#L380

Added line #L380 was not covered by tests
formula_or_cask,
name,
Expand Down Expand Up @@ -460,7 +462,9 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a
#{outdated_synced_formulae.join(", ")}.
EOS
end
if !args.no_pull_requests? && !versions_equal
if !args.no_pull_requests? &&
(new_version.general != "unable to get versions") &&

Check warning on line 466 in Library/Homebrew/dev-cmd/bump.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/bump.rb#L466

Added line #L466 was not covered by tests
!versions_equal
if duplicate_pull_requests
duplicate_pull_requests_text = duplicate_pull_requests
elsif maybe_duplicate_pull_requests
Expand Down

0 comments on commit 1cbcc44

Please sign in to comment.