Skip to content

Commit 663722a

Browse files
committed
Add option to add repos to organizations
1 parent da77143 commit 663722a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/Github/Api/Repo.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,19 @@ public function show($username, $repository)
5555
* Create repository
5656
* @link http://developer.github.com/v3/repos/
5757
*
58-
* @param string $name name of the repository
59-
* @param string $description repository description
60-
* @param string $homepage homepage url
61-
* @param boolean $public 1 for public, 0 for private
58+
* @param string $name name of the repository
59+
* @param string $description repository description
60+
* @param string $homepage homepage url
61+
* @param boolean $public 1 for public, 0 for private
62+
* @param boolean|string $organization username of organization if applicable
6263
*
6364
* @return array returns repository data
6465
*/
65-
public function create($name, $description = '', $homepage = '', $public = true)
66+
public function create($name, $description = '', $homepage = '', $public = true, $organization = false)
6667
{
67-
return $this->post('user/repos', array(
68+
$path = ($organization) ? 'orgs/'.$organization.'/repos' : 'user/repos';
69+
70+
return $this->post($path, array(
6871
'name' => $name,
6972
'description' => $description,
7073
'homepage' => $homepage,

0 commit comments

Comments
 (0)