Sha256: c27c526db49cbde70e9b55a41b65b92a7d2ac7e09eaa874cd6915d5d8d310d84

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

module Saddler
  module Reporter
    module Github
      class PullRequestReviewComment
        include ::Saddler::Reporter::Support
        include Helper

        # @param messages [String] checkstyle string
        # @param _options [Hash]
        #
        # @return [void]
        #
        # @see https://developer.github.com/v3/pulls/comments/#create-a-comment
        def report(messages, _options)
          repo_path = '.'
          repo = Repository.new(repo_path)

          data = parse(messages)
          client = Client.new(repo)
          # fetch pull_request_review_comments
          pull_request_review_comments = client.pull_request_review_comments

          patches = client.pull_request_patches

          # build comment
          comments = build_comments_with_patches(data, patches)
          return if comments.empty?

          posting_comments = comments - pull_request_review_comments
          return if posting_comments.empty?

          # create pull_request_review_comments
          posting_comments.each do |posting|
            client.create_pull_request_review_comment(posting)
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
saddler-reporter-github-2.1.0 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-2.0.0 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-1.0.0 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-0.4.0 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-0.3.0 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-0.2.2 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-0.2.1 lib/saddler/reporter/github/pull_request_review_comment.rb
saddler-reporter-github-0.2.0 lib/saddler/reporter/github/pull_request_review_comment.rb