class Ellen::Github::Actions::CreatePullRequest

Public Instance Methods

call() click to toggle source
# File lib/ellen/github/actions/create_pull_request.rb, line 5
def call
  if has_access_token?
    create
  else
    require_access_token
  end
end

Private Instance Methods

base() click to toggle source

e.g. master

# File lib/ellen/github/actions/create_pull_request.rb, line 68
def base
  to.split(":").last
end
create() click to toggle source
# File lib/ellen/github/actions/create_pull_request.rb, line 15
def create
  message.reply("Created #{pull_request.html_url}")
rescue Octokit::Unauthorized
  message.reply("Failed in authentication (401)")
rescue Octokit::NotFound
  message.reply("Could not find that repository")
rescue => exception
  message.reply("Failed by #{exception.class} #{exception}")
end
description() click to toggle source
# File lib/ellen/github/actions/create_pull_request.rb, line 33
def description
  message[:description]
end
from() click to toggle source

e.g. alice/foo:test

# File lib/ellen/github/actions/create_pull_request.rb, line 38
def from
  message[:from]
end
from_branch() click to toggle source

e.g. test

# File lib/ellen/github/actions/create_pull_request.rb, line 48
def from_branch
  from.split(":").last
end
from_user() click to toggle source

e.g. alice

# File lib/ellen/github/actions/create_pull_request.rb, line 43
def from_user
  from.split("/").first
end
head() click to toggle source

e.g. alice:test

# File lib/ellen/github/actions/create_pull_request.rb, line 63
def head
  "#{from_user}:#{from_branch}"
end
pull_request() click to toggle source
# File lib/ellen/github/actions/create_pull_request.rb, line 25
def pull_request
  client.create_pull_request(repository, base, head, title, description)
end
repository() click to toggle source

e.g. bob/foo

# File lib/ellen/github/actions/create_pull_request.rb, line 58
def repository
  to.split(":").first
end
title() click to toggle source
# File lib/ellen/github/actions/create_pull_request.rb, line 29
def title
  message[:title]
end
to() click to toggle source

e.g. bob/foo:master

# File lib/ellen/github/actions/create_pull_request.rb, line 53
def to
  message[:to]
end