class GithubBot::Github::CheckRun

Public: Class to keep track of the check run that has been created for execution

Attributes

name[R]

The name/identifier of the check run

Public Class Methods

new(name:, repo:, sha:, client_api:, **opts) click to toggle source

Public: Create a new instance of the CheckRun

@params opts [Hash] A hash of options to utilized within the check run @option opts [:symbol] :name The name of the check run @option opts [:symbol] :repo The repository the checked run will be associated @option opts [:symbol] :sha The SHA commit for the check run to execute @option opts [:symbol] :client_api The GitHub API

# File lib/github_bot/github/check_run.rb, line 17
def initialize(name:, repo:, sha:, client_api:, **opts)
  @client_api = client_api
  @repo = repo
  @sha = sha
  @name = name
  @run = @client_api.create_check_run(
    repo,
    name,
    sha,
    opts.merge(
      status: 'queued'
    )
  )
end

Public Instance Methods

action_required!(**options) click to toggle source

Public: Updates the check run to require action

# File lib/github_bot/github/check_run.rb, line 43
def action_required!(**options)
  update(status: 'completed', conclusion: 'action_required', completed_at: Time.now, **options)
end
complete!(**options) click to toggle source

Public: Updates the check run to be complete

# File lib/github_bot/github/check_run.rb, line 38
def complete!(**options)
  update(status: 'completed', conclusion: 'success', completed_at: Time.now, **options)
end
in_progress!(**options) click to toggle source

Public: Updates the check run to be in progress

# File lib/github_bot/github/check_run.rb, line 33
def in_progress!(**options)
  update(status: 'in_progress', started_at: Time.now, **options)
end

Private Instance Methods

update(**options) click to toggle source
# File lib/github_bot/github/check_run.rb, line 49
def update(**options)
  options[:accept] = Octokit::Preview::PREVIEW_TYPES[:checks]

  @client_api.update_check_run(@repo, @run.id, options)
end