class Jackal::Nellie::Formatter::GithubCommitStatus

Constants

DESTINATION

Destination service

SOURCE

Source service

Public Instance Methods

format(payload) click to toggle source

Format payload to provide output status to GitHub

@param payload [Smash]

# File lib/jackal-nellie/formatter/github_commit_status.rb, line 19
def format(payload)
  if(payload.get(:data, :nellie, :status))
    payload.set(:data, :github_kit, :status,
      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),
        :state => payload.get(:data, :nellie, :status) == 'success' ? 'success' : 'failure',
        :extras => {
          :context => 'nellie',
          :description => payload.get(:data, :nellie, :status) == 'success' ?
            "#{app_config.fetch(:branding, :name, 'Nellie')} completed successfully" :
            "#{app_config.fetch(:branding, :name, 'Nellie')} failed to complete"
        }
      )
    )
  end
end