Skip to content

Commit

Permalink
bug #6 Close PR after rebased commits (peterrehm)
Browse files Browse the repository at this point in the history
Discussion
----------

In case of a rebase according to #4 github does not detect the merge automatically.

Tickets:
- none

Commits
-------

- 28945f1 Close unmerged PR (peterrehm)
  • Loading branch information
peterrehm committed Oct 25, 2015
2 parents e4ea7df + 305fa94 commit 8889fdf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Command/MergeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ public function execute(InputInterface $input, OutputInterface $output)
return;
}

$pr = $client->pullRequest()->show($input->getOption('username'), $input->getOption('repository'), $input->getArgument('pr'));

// In case of a rebase the PR might not be closed, so close automatically
if (false === $pr['merged']) {
$client->pullRequest()->update($input->getOption('username'), $input->getOption('repository'), $input->getArgument('pr'), ['state' => 'closed']);
}

$output->writeln('The pull request has been merged successfully.');
}
}

0 comments on commit 8889fdf

Please sign in to comment.