Skip to content

Commit 3acf131

Browse files
committed
Add commit_message parameter on Repo::merge only if given
If you add the commit_message with null value, you will get this error: For 'properties/commit_message', nil is not a string. So the commit_message parameter has to be added only if $message is valid.
1 parent f77df24 commit 3acf131

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/Github/Api/Repo.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,16 @@ public function subscribers($username, $repository, $page = 1)
488488
*/
489489
public function merge($username, $repository, $base, $head, $message = null)
490490
{
491-
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', array(
492-
'base' => $base,
493-
'head' => $head,
494-
'commit_message' => $message
495-
));
491+
$parameters = array(
492+
'base' => $base,
493+
'head' => $head,
494+
);
495+
496+
if (is_string($message)) {
497+
$parameters['commit_message'] = $message;
498+
}
499+
500+
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', $parameters);
496501
}
497502

498503
/**

0 commit comments

Comments
 (0)