module RubocopAutomata

Create GitHub PullRequest of rubocop –auto-correct in CI Service

Constants

VERSION

Public Instance Methods

backend_ci=(ci) click to toggle source
# File lib/rubocop_automata.rb, line 37
def backend_ci=(ci)
  @@backend_ci = ci
end
boot(github_email:, github_username:) click to toggle source
# File lib/rubocop_automata.rb, line 13
def boot(github_email:, github_username:)
  if ENV['GITHUB_ACCESS_TOKEN'].nil?
    raise 'Please input ENV of GITHUB_ACCESS_TOKEN'
  end

  if RubocopAutomata::Skill.rubocop_autocorrect
    RubocopAutomata::Skill.create_branch(
      @@backend_ci.repository_url,
      github_email,
      github_username,
      @@backend_ci.topic_branch
    )
    RubocopAutomata::Skill.create_pullrequest(
      @@backend_ci.repository_name,
      @@backend_ci.pullrequest_title,
      @@backend_ci.pullrequest_description,
      @@backend_ci.base_branch,
      @@backend_ci.topic_branch
    )
  end

  true
end