Class: Octofart::Tasks::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/octofart/tasks/pull_request.rb

Instance Method Summary collapse

Instance Method Details

#run(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/octofart/tasks/pull_request.rb', line 5

def run(params)
  params[:repositories].each_pair do |repo_name, |
    Octofart.client.update_ref(repo_name, [:head_branch][:name], [:head_branch][:sha])

    pull_request_opts = [
      repo_name,
      [:base_branch][:name],
      [:head_branch][:ref],
      params[:pull_request][:title],
      params[:pull_request][:body]
    ]

    Octofart.client.create_pull_request(*pull_request_opts)
  end

  params
end