Module: RubocopAutomata::CI::Local

Defined in:
lib/rubocop_automata/ci/local.rb

Overview

For localhost

Class Method Summary collapse

Class Method Details

.base_branchObject



15
16
17
18
19
20
# File 'lib/rubocop_automata/ci/local.rb', line 15

def base_branch
  if ENV['AUTOMATA_BASE_BRANCH'].nil?
    raise 'Please input ENV of AUTOMATA_BASE_BRANCH'
  end
  ENV['AUTOMATA_BASE_BRANCH']
end

.pullrequest_descriptionObject



30
31
32
33
34
35
# File 'lib/rubocop_automata/ci/local.rb', line 30

def pullrequest_description
  <<~DESCRIPTION
    PR: https://github.com/#{repository_name}/pull/:id
    Auto generated by localhost
  DESCRIPTION
end

.pullrequest_titleObject



26
27
28
# File 'lib/rubocop_automata/ci/local.rb', line 26

def pullrequest_title
  "rubocop --auto-correct at #{`echo -n $(date)`}"
end

.repository_nameObject



11
12
13
# File 'lib/rubocop_automata/ci/local.rb', line 11

def repository_name
  /^.+?github.com[:\/](?<repository_name>.+?)\.git$/.match(`git config --get remote.origin.url`)[:repository_name]
end

.repository_urlObject



7
8
9
# File 'lib/rubocop_automata/ci/local.rb', line 7

def repository_url
  "https://#{ENV['GITHUB_ACCESS_TOKEN']}@github.com/#{repository_name}"
end

.topic_branchObject



22
23
24
# File 'lib/rubocop_automata/ci/local.rb', line 22

def topic_branch
  @@topic_branch ||= "ci/auto_correction-#{Time.now.to_i}"
end