Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cmd/livecheck: Skip autobumped formulae #18984

Merged
merged 6 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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

Check warning on line 110 in Library/Homebrew/dev-cmd/livecheck.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/livecheck.rb#L110

Added line #L110 was not covered by tests
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 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.

Loading