Skip to content

Commit

Permalink
Merge pull request #16750 from iMichka/autobump
Browse files Browse the repository at this point in the history
bump-formula|cask-pr: do not allow to bump autobumped packages
  • Loading branch information
ZhongRuoyu authored Mar 1, 2024
2 parents 387332a + f96290e commit 38b671d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Library/Homebrew/dev-cmd/bump-cask-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ def bump_cask_pr
odie "This cask is not in a tap!" if cask.tap.blank?
odie "This cask's tap is not a Git repository!" unless cask.tap.git?

if ENV.fetch("HOMEBREW_TEST_BOT_AUTOBUMP", false).blank? &&
(cask.tap.core_cask_tap? &&
(autobump_file_path = cask.tap.path/Tap::HOMEBREW_TAP_AUTOBUMP_FILE) &&
autobump_file_path.exist? &&
autobump_file_path.readlines(chomp: true).include?(cask.token))
odie <<~EOS
Whoops, the #{cask.token} cask has its version update
pull requests automatically opened by BrewTestBot!
We'd still love your contributions, though, so try another one
that's not in the autobump list:
#{Formatter.url("#{cask.tap.remote}/blob/master/.github/autobump.txt")}
EOS
end

new_version = BumpVersionParser.new(
general: args.version,
intel: args.version_intel,
Expand Down
14 changes: 14 additions & 0 deletions Library/Homebrew/dev-cmd/bump-formula-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ def bump_formula_pr
odie "This formula is not in a tap!" if formula.tap.blank?
odie "This formula's tap is not a Git repository!" unless formula.tap.git?

if ENV.fetch("HOMEBREW_TEST_BOT_AUTOBUMP", nil).blank? &&
(formula.tap.core_tap? &&
(autobump_file_path = formula.tap.path/Tap::HOMEBREW_TAP_AUTOBUMP_FILE) &&
autobump_file_path.exist? &&
autobump_file_path.readlines(chomp: true).include?(formula.name))
odie <<~EOS
Whoops, the #{formula.name} formula has its version update
pull requests automatically opened by BrewTestBot!
We'd still love your contributions, though, so try another one
that's not in the autobump list:
#{Formatter.url("#{formula.tap.remote}/blob/master/.github/autobump.txt")}
EOS
end

formula_spec = formula.stable
odie "#{formula}: no stable specification found!" if formula_spec.blank?

Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Tap
HOMEBREW_TAP_CASK_RENAMES_FILE = "cask_renames.json"
HOMEBREW_TAP_FORMULA_RENAMES_FILE = "formula_renames.json"
HOMEBREW_TAP_MIGRATIONS_FILE = "tap_migrations.json"
HOMEBREW_TAP_AUTOBUMP_FILE = ".github/autobump.txt"
HOMEBREW_TAP_AUDIT_EXCEPTIONS_DIR = "audit_exceptions"
HOMEBREW_TAP_STYLE_EXCEPTIONS_DIR = "style_exceptions"
HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS = "pypi_formula_mappings.json"
Expand Down

0 comments on commit 38b671d

Please sign in to comment.