diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 98b4f9518e..277fe94640 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -166,7 +166,6 @@ module Kernel disable = true if disable_for_developers && Homebrew::EnvConfig.developer? if disable || Homebrew.raise_deprecation_exceptions? - puts GitHub::Actions::Annotation.new(:error, message, file:, line:) if GitHub::Actions.env_set? GitHub::Actions.puts_annotation_if_env_set(:error, message, file:, line:) exception = MethodDeprecatedError.new(message) exception.set_backtrace(backtrace) diff --git a/Library/Homebrew/utils/github/actions.rb b/Library/Homebrew/utils/github/actions.rb index 5ddb61ec74..3d6e57cc47 100644 --- a/Library/Homebrew/utils/github/actions.rb +++ b/Library/Homebrew/utils/github/actions.rb @@ -50,8 +50,10 @@ module GitHub def self.puts_annotation_if_env_set(type, message, file: nil, line: nil) # Don't print annotations during tests, too messy to handle these. return if ENV.fetch("HOMEBREW_TESTS", false) + return unless env_set? - puts Annotation.new(type, message) if env_set? + std = (type == :notice) ? $stdout : $stderr + std.puts Annotation.new(type, message) end # Helper class for formatting annotations on GitHub Actions.