Skip to content

Commit

Permalink
extend/kernel: make opoo/odie/etc. print GitHub Actions notes.
Browse files Browse the repository at this point in the history
We already do this for deprecations but these may make warnings
and errors from Homebrew easier to spot in GitHub Actions logs.
  • Loading branch information
MikeMcQuaid committed May 8, 2024
1 parent 9bf7734 commit cbcf7c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ def setup_environment!
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
ENV["HOMEBREW_SORBET_RUNTIME"] = "1"

# We don't want tests to change behaviour based on where they are run.
ENV.delete("GITHUB_ACTIONS")

# TODO: remove this and fix tests when possible.
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
ENV.delete("HOMEBREW_INTERNAL_JSON_V3")
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/extend/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def oh1(title, truncate: :auto)
def opoo(message)
Tty.with($stderr) do |stderr|
stderr.puts Formatter.warning(message, label: "Warning")
puts "::warning::#{message}" if ENV["GITHUB_ACTIONS"]
end
end

Expand All @@ -73,6 +74,7 @@ def opoo(message)
def onoe(message)
Tty.with($stderr) do |stderr|
stderr.puts Formatter.error(message, label: "Error")
puts "::error::#{message}" if ENV["GITHUB_ACTIONS"]
end
end

Expand Down

0 comments on commit cbcf7c1

Please sign in to comment.