Skip to content

Commit

Permalink
bug #1051 Boolean private needed to create private repo! (mruell)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 3.4.x-dev branch.

Discussion
----------

Apparently there was an GitHub API change. When private is not set to `true` the visibility `private` is ignored

Commits
-------

bc93867 Boolean private needed to create private repo as seen in: https://docs.github.com/en/rest/reference/repos#create-an-organization-repository
a1f9686 Fix tests
  • Loading branch information
mruell authored Feb 18, 2022
1 parent 9906308 commit 4916a94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Github/Api/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public function create(
'name' => $name,
'description' => $description,
'homepage' => $homepage,
'private' => ($visibility ?? ($public ? 'public' : 'private')) === 'private',
'visibility' => $visibility ?? ($public ? 'public' : 'private'),
'has_issues' => $hasIssues,
'has_wiki' => $hasWiki,
Expand Down
4 changes: 4 additions & 0 deletions test/Github/Tests/Api/RepoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function shouldCreateRepositoryUsingNameOnly()
'description' => '',
'homepage' => '',
'visibility' => 'public',
'private' => false,
'has_issues' => false,
'has_wiki' => false,
'has_downloads' => false,
Expand All @@ -122,6 +123,7 @@ public function shouldCreateRepositoryForOrganization()
'description' => '',
'homepage' => '',
'visibility' => 'public',
'private' => false,
'has_issues' => false,
'has_wiki' => false,
'has_downloads' => false,
Expand Down Expand Up @@ -153,6 +155,7 @@ public function shouldCreateRepositoryWithInternalVisibility()
'auto_init' => false,
'has_projects' => true,
'visibility' => 'internal',
'private' => false,
])
->will($this->returnValue($expectedArray));

Expand Down Expand Up @@ -372,6 +375,7 @@ public function shouldCreateUsingAllParams()
'description' => 'test',
'homepage' => 'http://l3l0.eu',
'visibility' => 'private',
'private' => true,
'has_issues' => false,
'has_wiki' => false,
'has_downloads' => false,
Expand Down

0 comments on commit 4916a94

Please sign in to comment.