Class: GithubFlowCli::PrCommands
- Inherits:
-
Thor
- Object
- Thor
- GithubFlowCli::PrCommands
- Defined in:
- lib/commands/pr.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
8 9 10 11 12 13 |
# File 'lib/commands/pr.rb', line 8 def all pull_requests = API.pull_requests(Local.repo) unless pull_requests.empty? puts pull_requests.map { |p| "##{p.number} (#{p.assignee&.login || "NONE"}): #{p.title}" } end end |
#create(title = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/commands/pr.rb', line 16 def create(title = nil) puts API.create_pr(title: title).html_url rescue Octokit::UnprocessableEntity => ex case ex. when /no commits between .*? and/i puts "No commits between base and head, stop creating PR..." when /already exists/ puts "PR already exists." pr_number = Config.pr_branch_map.find {|_, v| v == Local.git.current_branch }.first puts API.pull_request(Local.repo, pr_number).html_url else raise end end |