Class: Jackal::Nellie::Formatter::GithubCommitComment

Inherits:
Formatter
  • Object
show all
Includes:
MessageExtract
Defined in:
lib/jackal-nellie/formatter/github_commit_comment.rb

Constant Summary collapse

SOURCE =

Source service

:nellie
DESTINATION =

Destination service

:github_kit

Instance Method Summary collapse

Methods included from MessageExtract

#failure_message, #success_message

Instance Method Details

#format(payload) ⇒ Object

Format payload to provide output comment to GitHub

Parameters:

  • payload (Smash)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/jackal-nellie/formatter/github_commit_comment.rb', line 19

def format(payload)
  if(payload.get(:data, :nellie, :result))
    payload.set(:data, :github_kit, :commit_comment,
      Smash.new(
        :repository => [
          payload.get(:data, :code_fetcher, :info, :owner),
          payload.get(:data, :code_fetcher, :info, :name)
        ].join('/'),
        :reference => payload.get(:data, :code_fetcher, :info, :commit_sha)
      )
    )
    if(payload.get(:data, :nellie, :result, :complete))
      payload.set(:data, :github_kit, :commit_comment, :message, success_message(payload))
    else
      payload.set(:data, :github_kit, :commit_comment, :message, failure_message(payload))
    end
  end
end