Class: Ruboty::BitbucketMerge::Actions::MergeBranch

Inherits:
Actions::Base
  • Object
show all
Defined in:
lib/ruboty/bitbucket_merge/actions/merge_branch.rb

Instance Method Summary collapse

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruboty/bitbucket_merge/actions/merge_branch.rb', line 6

def call
  @team = message[:team]
  @repo = message[:repo]
  @source = message[:source]
  @target = message[:target]
  
  @user = ENV["BITBUCKET_USERNAME"]
  @pass = ENV["BITBUCKET_PASSWORD"]
  @emakl = ENV["BITBUCKET_EMAIL"]

  begin
    pr_id, links = create_pull_request
    merge_message = build_merge_message(links["commits"]["href"])
    merge_pull_request(links["merge"]["href"], pr_id, merge_message)
    message.reply("Successfully merged.\n\n" + merge_message)
  rescue
    message.reply("Failed to merge.")
  end
end