Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github/actions: fix annotation title handling #18283

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Library/Homebrew/utils/github/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def self.path_relative_to_workspace(path)
}
def initialize(type, message, file: nil, title: nil, line: nil, end_line: nil, column: nil, end_column: nil)
raise ArgumentError, "Unsupported type: #{type.inspect}" if ANNOTATION_TYPES.exclude?(type)
raise ArgumentError, "`title` must not contain `::`" if title.present? && title.include?("::")

require "utils/tty"
@type = type
Expand Down Expand Up @@ -110,7 +111,11 @@ def to_s
end
end

metadata << ",title=#{Actions.escape(@title)}" if @title
if @title
metadata << (@file ? "," : " ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go into an array which we join(",")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, good point.

metadata << "title=#{Actions.escape(@title)}"
end
metadata << " " if metadata.end_with?(":")

"::#{metadata}::#{Actions.escape(@message)}"
end
Expand Down