Skip to content

Commit

Permalink
Merge pull request #12900 from issyl0/bump-no-prereleases-based-on-li…
Browse files Browse the repository at this point in the history
…vecheck

dev-cmd/bump: Ignore Repology if the livecheck uses `GithubLatest`
  • Loading branch information
MikeMcQuaid committed Feb 21, 2022
2 parents 88b8006 + 9ad3a9c commit 2dc375a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Library/Homebrew/dev-cmd/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ def livecheck_result(formula_or_cask)
version_info = Livecheck.latest_version(
formula_or_cask,
referenced_formula_or_cask: referenced_formula_or_cask,
json: true, full_name: false, verbose: false, debug: false
json: true, full_name: false, verbose: true, debug: false
)
latest = version_info[:latest] if version_info.present?
return "unable to get versions" if version_info.blank?

return "unable to get versions" if latest.blank?
latest = version_info[:latest]
strategy = version_info[:meta][:strategy]

Version.new(latest)
[Version.new(latest), strategy]
rescue => e
"error: #{e}"
end
Expand All @@ -233,7 +234,7 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a
version_name = "cask version "
end

livecheck_latest = livecheck_result(formula_or_cask)
livecheck_latest, livecheck_strategy = livecheck_result(formula_or_cask)

repology_latest = if repositories.present?
Repology.latest_version(repositories)
Expand All @@ -243,7 +244,7 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a

new_version = if livecheck_latest.is_a?(Version) && livecheck_latest > current_version
livecheck_latest
elsif repology_latest.is_a?(Version) && repology_latest > current_version
elsif repology_latest.is_a?(Version) && repology_latest > current_version && livecheck_strategy != "GithubLatest"
repology_latest
end.presence

Expand All @@ -268,6 +269,14 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a
EOS

return unless args.open_pr?

if repology_latest > current_version &&
repology_latest > livecheck_latest &&
livecheck_strategy == "GithubLatest"
puts "#{title_name} was not bumped to the Repology version because that " \
"version is not the latest release on GitHub."
end

return unless new_version
return if pull_requests

Expand Down

0 comments on commit 2dc375a

Please sign in to comment.