Sha256: 0d5250c96877858063ef1224acc849ca913ccf3191f89638765dd3ec5ec8c85d
Contents?: true
Size: 904 Bytes
Versions: 4
Compression:
Stored size: 904 Bytes
Contents
module Pronto module Formatter class GitlabFormatter def format(messages, repo) messages = messages.uniq { |message| [message.msg, message.line.new_lineno] } client = Gitlab.new repo commit_messages = messages.map do |message| create_comment(client, message.commit_sha, message.msg, message.path, message.line.commit_line.new_lineno) end "#{commit_messages.compact.count} Pronto messages posted to GitLab" end private def create_comment(client, sha, note, path, line) comment = Gitlab::Comment.new(sha, note, path, line) 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
4 entries across 4 versions & 1 rubygems