Sha256: 523590e3afd560e86c4980bfbdf0455991e58f2357099e29cb3bd86f479d4c86
Contents?: true
Size: 844 Bytes
Versions: 5
Compression:
Stored size: 844 Bytes
Contents
module Pronto module Formatter class GithubFormatter def format(messages, repo, _) client = Github.new(repo) commit_messages = messages.uniq.map do |message| sha = message.commit_sha body = message.msg path = message.path position = message.line.commit_line.position if message.line create_comment(client, sha, body, path, position) end "#{commit_messages.compact.count} Pronto messages posted to GitHub" end private def create_comment(client, sha, body, path, position) comment = Github::Comment.new(sha, body, path, position) comments = client.commit_comments(sha) existing = comments.any? { |c| comment == c } client.create_commit_comment(comment) unless existing end end end end
Version data entries
5 entries across 5 versions & 1 rubygems