diff --git a/Library/Homebrew/attestation.rb b/Library/Homebrew/attestation.rb index e62564394e..0e4b305ac9 100644 --- a/Library/Homebrew/attestation.rb +++ b/Library/Homebrew/attestation.rb @@ -53,7 +53,6 @@ module Homebrew return true if Homebrew::EnvConfig.verify_attestations? return false if GitHub::API.credentials.blank? return false if ENV.fetch("CI", false) - return false unless Formula["gh"].any_version_installed? Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun? end @@ -70,7 +69,7 @@ module Homebrew return @gh_executable if @gh_executable.present? with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do - @gh_executable = ensure_executable!("gh") + @gh_executable = ensure_executable!("gh", reason: "verifying attestations") gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false) .stdout.match(/\d+(?:\.\d+)+/i).to_s) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index bab0b2e903..9b8b9d59e4 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -267,7 +267,7 @@ module Homebrew if formulae.include?(Formula["gh"]) formulae.unshift(T.must(formulae.delete(Formula["gh"]))) else - Homebrew::Attestation.ensure_gh_installed! + Homebrew::Attestation.gh_executable end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 37046832f0..5f8a75144d 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -128,7 +128,7 @@ module Homebrew if formulae.include?(Formula["gh"]) formulae.unshift(T.must(formulae.delete(Formula["gh"]))) else - Homebrew::Attestation.ensure_gh_installed! + Homebrew::Attestation.gh_executable end end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 75645c94f2..cab4f27556 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -138,7 +138,7 @@ module Homebrew if formulae.include?(Formula["gh"]) formulae.unshift(formulae.delete(Formula["gh"])) else - Homebrew::Attestation.ensure_gh_installed! + Homebrew::Attestation.gh_executable end end diff --git a/Library/Homebrew/test/attestation_spec.rb b/Library/Homebrew/test/attestation_spec.rb index 1df9afd6e3..850b450892 100644 --- a/Library/Homebrew/test/attestation_spec.rb +++ b/Library/Homebrew/test/attestation_spec.rb @@ -77,7 +77,7 @@ RSpec.describe Homebrew::Attestation do it "calls ensure_executable and ensure_formula_installed" do expect(described_class).to receive(:ensure_executable!) - .with("gh") + .with("gh", reason: "verifying attestations") .and_return(fake_old_gh) expect(described_class).to receive(:ensure_formula_installed!)