Skip to content

Commit

Permalink
Making sure no issue is opened if we are in a merge request
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Apr 28, 2017
1 parent fdf346f commit 830cca8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Commands/RunCommand.php
Expand Up @@ -149,6 +149,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

$buildService = new BuildService($client);

$inMergeRequest = false;

try {
$mergeRequest = $buildService->findMergeRequestByBuildRef($projectName, $buildRef);

Expand All @@ -175,6 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$client->merge_requests->addComment($projectName, $mergeRequest['id'], (string) $message);

$inMergeRequest = true;
} catch (MergeRequestNotFoundException $e) {
// If there is no merge request attached to this build, let's skip the merge request comment. We can still make some comments on the commit itself!
$output->writeln('It seems that this CI build is not part of a merge request.');
Expand All @@ -187,7 +190,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$sendCommentService->sendDifferencesCommentsInCommit($methodsProvider, $lastCommitMethodsProvider, $projectName, $buildRef, $gitlabUrl);


if ($config->isOpenIssue()) {
if ($config->isOpenIssue() && !$inMergeRequest) {
$message = new Message();

if ($codeCoverageProvider !== null) {
Expand Down

0 comments on commit 830cca8

Please sign in to comment.