Class: Pronto::Formatter::CommitFormatter

Inherits:
GitFormatter show all
Defined in:
lib/pronto/formatter/commit_formatter.rb

Instance Method Summary collapse

Methods inherited from GitFormatter

#client_module, #format, #pretty_name

Methods inherited from Base

#config, name

Instance Method Details

#existing_comments(messages, client, _) ⇒ Object



4
5
6
7
8
# File 'lib/pronto/formatter/commit_formatter.rb', line 4

def existing_comments(messages, client, _)
  shas = messages.map(&:commit_sha)
  comments = shas.flat_map { |sha| client.commit_comments(sha) }
  grouped_comments(comments)
end

#submit_comments(client, comments) ⇒ Object



10
11
12
13
14
15
# File 'lib/pronto/formatter/commit_formatter.rb', line 10

def submit_comments(client, comments)
  comments.each { |comment| client.create_commit_comment(comment) }
rescue Octokit::UnprocessableEntity, HTTParty::Error => e
  $stderr.puts "Failed to post: #{e.message}"
  $stderr.puts e.inspect
end