Class: FightClub::Merger

Inherits:
Object
  • Object
show all
Defined in:
lib/fight_club/merger.rb

Class Method Summary collapse

Class Method Details

.attempt_merge(pr, git) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fight_club/merger.rb', line 3

def self.attempt_merge(pr, git)
  git.reset_hard("origin/#{pr["head"]["ref"]}")
  result = git.merge("origin/#{FightClub.config.master_branch}")

  if result.include? 'CONFLICT'
    Commenter.comment(pr, 'Your branch is currently conflicting with the target branch. Please resolve all merge conflicts and repush.')

    git.merge_abort

    return false
  end

  true
end