mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Output GitHub warning/error annotations to stderr
This will mean e.g. `opoo` etc. will output to stdout and not end up being in the stdout of `brew deps` etc. While we're here, remove a duplicate annotation output I noticed in `extend/kernel.rb`. Inspired by conversation in: https://github.com/Homebrew/homebrew-test-bot/issues/1082
This commit is contained in:
parent
968d56cb7a
commit
e573a53868
@ -166,7 +166,6 @@ module Kernel
|
|||||||
|
|
||||||
disable = true if disable_for_developers && Homebrew::EnvConfig.developer?
|
disable = true if disable_for_developers && Homebrew::EnvConfig.developer?
|
||||||
if disable || Homebrew.raise_deprecation_exceptions?
|
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:)
|
GitHub::Actions.puts_annotation_if_env_set(:error, message, file:, line:)
|
||||||
exception = MethodDeprecatedError.new(message)
|
exception = MethodDeprecatedError.new(message)
|
||||||
exception.set_backtrace(backtrace)
|
exception.set_backtrace(backtrace)
|
||||||
|
@ -50,8 +50,10 @@ module GitHub
|
|||||||
def self.puts_annotation_if_env_set(type, message, file: nil, line: nil)
|
def self.puts_annotation_if_env_set(type, message, file: nil, line: nil)
|
||||||
# Don't print annotations during tests, too messy to handle these.
|
# Don't print annotations during tests, too messy to handle these.
|
||||||
return if ENV.fetch("HOMEBREW_TESTS", false)
|
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
|
end
|
||||||
|
|
||||||
# Helper class for formatting annotations on GitHub Actions.
|
# Helper class for formatting annotations on GitHub Actions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user