Class: Pronto::Formatter::PullRequestFormatter

Inherits:
GitFormatter show all
Defined in:
lib/pronto/formatter/pull_request_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(_, client, repo) ⇒ Object



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

def existing_comments(_, client, repo)
  sha = repo.head_commit_sha
  comments = client.pull_comments(sha)
  grouped_comments(comments)
end

#submit_comments(client, comments) ⇒ Object



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

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