Merge pull request #18283 from Homebrew/annotation-titles

github/actions: fix annotation title handling
This commit is contained in:
Bo Anderson 2024-09-09 02:55:16 +01:00 committed by GitHub
commit d8d9151c8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,6 +81,7 @@ module GitHub
}
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
@ -110,7 +111,11 @@ module GitHub
end
end
metadata << ",title=#{Actions.escape(@title)}" if @title
if @title
metadata << (@file ? "," : " ")
metadata << "title=#{Actions.escape(@title)}"
end
metadata << " " if metadata.end_with?(":")
"::#{metadata}::#{Actions.escape(@message)}"
end