4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pronto/formatter/github_pull_request_formatter.rb', line 4
def format(messages, repo)
commit_messages = messages.map do |message|
github_slug = repo.github_slug
body = message.msg
path = message.path
commits = repo.commits_until(message.commit_sha)
line = nil
sha = commits.find do |commit|
patches = repo.show_commit(commit)
line = patches.find_line(message.full_path, message.line.new_lineno)
line
end
= Github::Comment.new(github_slug, sha, body, path, line.position)
(github_slug, sha, )
end
"#{commit_messages.compact.count} Pronto messages posted to GitHub"
end
|