Skip to content

Commit

Permalink
Merge pull request #18984 from Homebrew/livecheck-skip-autobumped-for…
Browse files Browse the repository at this point in the history
…mulae

dev-cmd/livecheck: Skip autobumped formulae
  • Loading branch information
issyl0 authored Jan 4, 2025
2 parents 8b1470e + ce562c3 commit 683f85f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Library/Homebrew/dev-cmd/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class LivecheckCmd < AbstractCommand
description: "Only check casks."
switch "--extract-plist",
description: "Enable checking multiple casks with ExtractPlist strategy."
switch "--autobump",
description: "Include packages that are autobumped by BrewTestBot. By default these are skipped."

conflicts "--debug", "--json"
conflicts "--tap=", "--eval-all", "--installed"
Expand Down Expand Up @@ -90,6 +92,26 @@ def run
end
end

if skip_autobump?
autobump_lists = {}

formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask|
tap = formula_or_cask.tap
next false if tap.nil?

autobump_lists[tap] ||= begin
autobump_path = tap.path/".github/autobump.txt"
autobump_path.exist? ? autobump_path.readlines.map(&:strip) : []
end

name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
if autobump_lists[tap].include?(name)
odebug "Skipping #{name} as it is autobumped in #{tap}."
true
end
end
end

formulae_and_casks_to_check = formulae_and_casks_to_check.sort_by do |formula_or_cask|
formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
end
Expand Down Expand Up @@ -117,6 +139,11 @@ def run
def watchlist_path
@watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String))
end

sig { returns(T::Boolean) }
def skip_autobump?
!(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)
end
end
end
end
4 changes: 4 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ module EnvConfig
default_text: 'The "Beer Mug" emoji.',
default: "🍺",
},
HOMEBREW_LIVECHECK_AUTOBUMP: {
description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.",
boolean: true,
},
HOMEBREW_LIVECHECK_WATCHLIST: {
description: "Consult this file for the list of formulae to check by default when no formula argument " \
"is passed to `brew livecheck`.",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 683f85f

Please sign in to comment.