Skip to content

Commit 683f85f

Browse files
authored
Merge pull request #18984 from Homebrew/livecheck-skip-autobumped-formulae
dev-cmd/livecheck: Skip autobumped formulae
2 parents 8b1470e + ce562c3 commit 683f85f

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

Library/Homebrew/dev-cmd/livecheck.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class LivecheckCmd < AbstractCommand
3838
description: "Only check casks."
3939
switch "--extract-plist",
4040
description: "Enable checking multiple casks with ExtractPlist strategy."
41+
switch "--autobump",
42+
description: "Include packages that are autobumped by BrewTestBot. By default these are skipped."
4143

4244
conflicts "--debug", "--json"
4345
conflicts "--tap=", "--eval-all", "--installed"
@@ -90,6 +92,26 @@ def run
9092
end
9193
end
9294

95+
if skip_autobump?
96+
autobump_lists = {}
97+
98+
formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask|
99+
tap = formula_or_cask.tap
100+
next false if tap.nil?
101+
102+
autobump_lists[tap] ||= begin
103+
autobump_path = tap.path/".github/autobump.txt"
104+
autobump_path.exist? ? autobump_path.readlines.map(&:strip) : []
105+
end
106+
107+
name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
108+
if autobump_lists[tap].include?(name)
109+
odebug "Skipping #{name} as it is autobumped in #{tap}."
110+
true
111+
end
112+
end
113+
end
114+
93115
formulae_and_casks_to_check = formulae_and_casks_to_check.sort_by do |formula_or_cask|
94116
formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
95117
end
@@ -117,6 +139,11 @@ def run
117139
def watchlist_path
118140
@watchlist_path ||= T.let(File.expand_path(Homebrew::EnvConfig.livecheck_watchlist), T.nilable(String))
119141
end
142+
143+
sig { returns(T::Boolean) }
144+
def skip_autobump?
145+
!(args.autobump? || Homebrew::EnvConfig.livecheck_autobump?)
146+
end
120147
end
121148
end
122149
end

Library/Homebrew/env_config.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ module EnvConfig
296296
default_text: 'The "Beer Mug" emoji.',
297297
default: "🍺",
298298
},
299+
HOMEBREW_LIVECHECK_AUTOBUMP: {
300+
description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.",
301+
boolean: true,
302+
},
299303
HOMEBREW_LIVECHECK_WATCHLIST: {
300304
description: "Consult this file for the list of formulae to check by default when no formula argument " \
301305
"is passed to `brew livecheck`.",

Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/livecheck_cmd.rbi

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)