class Ruboty::Github::Actions::CreatePullRequest
Public Instance Methods
call()
click to toggle source
# File lib/ruboty/github/actions/create_pull_request.rb, line 7 def call if has_access_token? create_with_error_handling else require_access_token end # Action handlers should return truthy value to tell ruboty that the given message has been handled. # Otherwise, ruboty tries to execute other handlers. true end
Private Instance Methods
base()
click to toggle source
e.g. master
# File lib/ruboty/github/actions/create_pull_request.rb, line 73 def base to.split(':').last end
create()
click to toggle source
# File lib/ruboty/github/actions/create_pull_request.rb, line 30 def create message.reply("Created #{pull_request.html_url}") end
create_with_error_handling()
click to toggle source
# File lib/ruboty/github/actions/create_pull_request.rb, line 20 def create_with_error_handling create rescue Octokit::Unauthorized message.reply('Failed in authentication (401)') rescue Octokit::NotFound message.reply('Could not find that repository') rescue StandardError => e message.reply("Failed by #{e.class} #{e}") end
from()
click to toggle source
e.g. alice/foo:test
# File lib/ruboty/github/actions/create_pull_request.rb, line 43 def from message[:from] end
from_branch()
click to toggle source
e.g. test
# File lib/ruboty/github/actions/create_pull_request.rb, line 53 def from_branch from.split(':').last end
from_user()
click to toggle source
e.g. alice
# File lib/ruboty/github/actions/create_pull_request.rb, line 48 def from_user from.split('/').first end
head()
click to toggle source
e.g. alice:test
# File lib/ruboty/github/actions/create_pull_request.rb, line 68 def head "#{from_user}:#{from_branch}" end
pull_request()
click to toggle source
# File lib/ruboty/github/actions/create_pull_request.rb, line 34 def pull_request client.create_pull_request(repository, base, head, title, body) end
repository()
click to toggle source
e.g. bob/foo
# File lib/ruboty/github/actions/create_pull_request.rb, line 63 def repository to.split(':').first end
title()
click to toggle source
# File lib/ruboty/github/actions/create_pull_request.rb, line 38 def title message[:title] end
to()
click to toggle source
e.g. bob/foo:master
# File lib/ruboty/github/actions/create_pull_request.rb, line 58 def to message[:to] end