Skip to content

Commit 3244176

Browse files
committed
Don't post too large comments
1 parent 4d0cc8a commit 3244176

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

compare_gem_versions

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,28 @@ def gem_compare_command(gem_name:, from:, to:, diff: false)
8181
end
8282

8383
def gem_compare_comment(command:, output:)
84-
<<~COMMENT
85-
<Details><Summary><h2><code>#{command.join(" ")}</code></h2></Summary>
84+
not_output_chars = 150
85+
max_size = 65_536 - not_output_chars
86+
too_large_output = output.size > max_size
8687

87-
````ruby
88-
#{output}
89-
````
90-
</Details>
88+
if too_large_output
89+
<<~COMMENT
90+
<h2><code>#{command.join(" ")}</code></h2>
9191
92-
COMMENT
92+
Diff too large (#{output.size} chars)
93+
94+
COMMENT
95+
else
96+
<<~COMMENT
97+
<Details><Summary><h2><code>#{command.join(" ")}</code></h2></Summary>
98+
99+
````ruby
100+
#{output}
101+
````
102+
</Details>
103+
104+
COMMENT
105+
end
93106
end
94107

95108
#

0 commit comments

Comments
 (0)