lib/github_bot/validator/base.rb
# Public: Block for execution logic that is the be evaluated and finalized
# within the GitHub check run content
Block for execution logic that is the be evaluated and finalized
within the GitHub check run content
Block for execution logic that is the be evaluated and finalized within the GitHub check run content
def check_run(name:, **_opts)
        @check = client_api.create_check_run(
          name: name,
          output: {
            title: "#{name} validation has been queued...",
            summary: "We're awaiting processing."
          }
        )
        yield if block_given?
        if @feedback.empty?
          @check.complete!(
            output: {
              title: "#{name} validation is complete...",
              summary: "#{name} validation passed!"
            }
          )
        else
          non_warnings = @feedback.select { |h| h[:annotation_level] != 'warning' }
          if non_warnings.empty?
            @feedback.each_slice(50).to_a.each do |annotations|
              @check.neutral!(
                output: {
                  title: "#{name} validation is complete...",
                  summary: "#{name} validation determined there are no required changes; however, please review the " \
                           'warnings as they may impact future changes.',
                  annotations: annotations
                }
              )
            end
          else
            @feedback.each_slice(50).to_a.each do |annotations|
              @check.action_required!(
                output: {
                  title: "#{name} validation is complete...",
                  summary: "#{name} validation determined there are changes that need attention.",
                  annotations: annotations
                }
              )
            end
          end
        end
      rescue StandardError => e
        Rails.logger.error message: 'Error occurred during check run', exception: e
        @check.action_required!(
          output: {
            title: "#{name} validation failed...",
            summary: "# Message\n```\n#{e.message}\n```\n# Exception\n```\n#{e.backtrace.join("\n")}\n```"
          }
        )
      end
def check_run ( name : , ** _opts ) @check = client_api . create_check_run ( name : name , output : { title : "#{name} validation has been queued..." , summary : "We're awaiting processing." } ) yield if block_given? if @feedback . empty? @check . complete! ( output : { title : "#{name} validation is complete..." , summary : "#{name} validation passed!" } ) else non_warnings = @feedback . select { | h | h [ :annotation_level ] != 'warning' } if non_warnings . empty? @feedback . each_slice ( 50 ) . to_a . each do | annotations | @check . neutral! ( output : { title : "#{name} validation is complete..." , summary : "#{name} validation determined there are no required changes; however, please review the " 'warnings as they may impact future changes.' , annotations : annotations } ) end else @feedback . each_slice ( 50 ) . to_a . each do | annotations | @check . action_required! ( output : { title : "#{name} validation is complete..." , summary : "#{name} validation determined there are changes that need attention." , annotations : annotations } ) end end end rescue StandardError => e Rails . logger . error message : 'Error occurred during check run' , exception : e @check . action_required! ( output : { title : "#{name} validation failed..." , summary : "# Message\n```\n#{e.message}\n```\n# Exception\n```\n#{e.backtrace.join("\n")}\n```" } ) end
Public: Block for execution logic that is the be evaluated and finalized
within the GitHub check run content
Public : Block for execution logic that is the be evaluated and finalized within the GitHub check run content
# queue request for processing # because limitation of 50 checks per API call execution, break up annotations # https://developer.github.com/v3/checks/runs/ # need to identify if something other than warnings
name
<not_specific>
_opts
<not_specific>