Module: RubocopAutomata::Skill
- Defined in:
- lib/rubocop_automata/skill.rb
Overview
automata skill
Class Method Summary collapse
- .create_branch(repository_url, github_email, github_username, new_branch) ⇒ Object
- .create_pullrequest(repository_name, title, description, base_branch, topic_branch) ⇒ Object
- .rubocop_autocorrect ⇒ Object
Class Method Details
.create_branch(repository_url, github_email, github_username, new_branch) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/rubocop_automata/skill.rb', line 14 def create_branch(repository_url, github_email, github_username, new_branch) `git config --local user.email "#{github_email}"` `git config --local user.name "#{github_username}"` `git checkout -b #{new_branch}` `git add .` `git commit -m ":shirt: rubocop --auto-correct"` `git push #{repository_url} #{new_branch}` end |
.create_pullrequest(repository_name, title, description, base_branch, topic_branch) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rubocop_automata/skill.rb', line 23 def create_pullrequest(repository_name, title, description, base_branch, topic_branch) = <<~OPTIONS.strip -X POST -H "Authorization: token #{ENV['GITHUB_ACCESS_TOKEN']}" \ --data #{Shellwords.escape({title: title, body: description, head: topic_branch, base: base_branch}.to_json)} OPTIONS `curl #{} https://api.github.com/repos/#{repository_name}/pulls` end |
.rubocop_autocorrect ⇒ Object
9 10 11 12 |
# File 'lib/rubocop_automata/skill.rb', line 9 def rubocop_autocorrect `rubocop --auto-correct` `git diff --numstat` != '' end |