Skip to content

Commit ebfefc9

Browse files
committed
Merge pull request #67 from sgrodzicki/master
Fixed updating a pull request
2 parents 9c45fa4 + 6df2deb commit ebfefc9

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/Github/Api/PullRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ public function create($username, $repository, array $params)
102102
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
103103
}
104104

105-
public function update($username, $repository, array $params)
105+
public function update($username, $repository, $id, array $params)
106106
{
107107
if (isset($params['state']) && !in_array($params['state'], array('open', 'closed'))) {
108108
$params['state'] = 'open';
109109
}
110110

111-
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
111+
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id), $params);
112112
}
113113

114114
public function merged($username, $repository, $id)

lib/Github/Api/Repo.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,25 @@ public function watchers($username, $repository, $page = 1)
345345
'page' => $page
346346
));
347347
}
348+
349+
/**
350+
* Perform a merge
351+
* @link http://developer.github.com/v3/repos/merging/
352+
*
353+
* @param string $username
354+
* @param string $repository
355+
* @param string $base The name of the base branch that the head will be merged into.
356+
* @param string $head The head to merge. This can be a branch name or a commit SHA1.
357+
* @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.
358+
*
359+
* @return array|null
360+
*/
361+
public function merge($username, $repository, $base, $head, $message = null)
362+
{
363+
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/merges', array(
364+
'base' => $base,
365+
'head' => $head,
366+
'commit_message' => $message
367+
));
368+
}
348369
}

0 commit comments

Comments
 (0)