From fce36cd0e97e4626110d5c2e4d82f4cf0d012482 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Tue, 15 Oct 2024 12:11:39 +0200 Subject: [PATCH] main: patch brew to restore force functionality --- bump-formula-pr.rb.patch | 12 ++++++++++++ main.rb | 9 +++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 bump-formula-pr.rb.patch diff --git a/bump-formula-pr.rb.patch b/bump-formula-pr.rb.patch new file mode 100644 index 0000000..63aa452 --- /dev/null +++ b/bump-formula-pr.rb.patch @@ -0,0 +1,12 @@ +diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb +index 167ea9134a..e07aecfe83 100644 +--- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb ++++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb +@@ -472,6 +472,7 @@ module Homebrew + def check_pull_requests(formula, tap_remote_repo, state: nil, version: nil) + tap = formula.tap + return if tap.nil? ++ return if args.force? + + # if we haven't already found open requests, try for an exact match across all pull requests + GitHub.check_for_duplicate_pull_requests( diff --git a/main.rb b/main.rb index 822ee4c..58bab91 100644 --- a/main.rb +++ b/main.rb @@ -92,6 +92,11 @@ def read_brew(*args) end message += '[`action-homebrew-bump-formula`](https://github.com/dawidd6/action-homebrew-bump-formula)' + unless force.false? + brew_repo = read_brew '--repository' + git '-C', brew_repo, 'apply', "#{__dir__}/brew-bump-formula-pr.rb.patch" + end + # Do the livecheck stuff or not if livecheck.false? # Change formula name to full name @@ -115,8 +120,6 @@ def read_brew(*args) *("--version=#{version}" unless is_git), *("--tag=#{tag}" if is_git), *("--revision=#{revision}" if is_git), - *('--force' unless force.false?), - *('--quiet' unless force.false?), formula else # Support multiple formulae in input and change to full names if tap @@ -157,8 +160,6 @@ def read_brew(*args) "--version=#{version}", *("--fork-org=#{org}" unless org.blank?), *("--no-fork" unless no_fork.false?), - *('--force' unless force.false?), - *('--quiet' unless force.false?), formula rescue ErrorDuringExecution => e # Continue execution on error, but save the exeception