Class: Pronto::Formatter::GithubFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/formatter/github_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(messages, repo) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pronto/formatter/github_formatter.rb', line 6

def format(messages, repo)
  commit_messages = messages.map do |message|
    github_slug = repo.remotes.map(&:github_slug).compact.first
    sha = message.commit_sha
    position = message.line.commit_line.position if message.line
    path = message.path
    body = message.msg

    create_comment(github_slug, sha, position, path, body)
  end

  "#{commit_messages.compact.count} Pronto messages posted to GitHub"
end