Method: Kennel::GithubReporter#comment

Defined in:
lib/kennel/github_reporter.rb

#comment(body) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/kennel/github_reporter.rb', line 36

def comment(body)
  # truncate to maximum allowed comment size for github to avoid 422
  if body.bytesize > MAX_COMMENT_SIZE
    body = body.byteslice(0, MAX_COMMENT_SIZE - TRUNCATED_MSG.bytesize) + TRUNCATED_MSG
  end

  path = (@pr ? "/repos/#{@repo_part}/issues/#{@pr}/comments" : "/repos/#{@repo_part}/commits/#{@sha}/comments")
  post path, body: body
end