Merge pull request #16750 from iMichka/autobump

bump-formula|cask-pr: do not allow to bump autobumped packages
This commit is contained in:
Ruoyu Zhong 2024-03-02 00:33:06 +08:00 committed by GitHub
commit 38b671d8bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 0 deletions

View File

@ -89,6 +89,20 @@ module Homebrew
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,

View File

@ -112,6 +112,20 @@ module Homebrew
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?

View File

@ -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"