Skip to content

Commit 4916a94

Browse files
authored
bug KnpLabs#1051 Boolean private needed to create private repo! (mruell)
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
1 parent 9906308 commit 4916a94

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/Github/Api/Repo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public function create(
205205
'name' => $name,
206206
'description' => $description,
207207
'homepage' => $homepage,
208+
'private' => ($visibility ?? ($public ? 'public' : 'private')) === 'private',
208209
'visibility' => $visibility ?? ($public ? 'public' : 'private'),
209210
'has_issues' => $hasIssues,
210211
'has_wiki' => $hasWiki,

test/Github/Tests/Api/RepoTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function shouldCreateRepositoryUsingNameOnly()
9696
'description' => '',
9797
'homepage' => '',
9898
'visibility' => 'public',
99+
'private' => false,
99100
'has_issues' => false,
100101
'has_wiki' => false,
101102
'has_downloads' => false,
@@ -122,6 +123,7 @@ public function shouldCreateRepositoryForOrganization()
122123
'description' => '',
123124
'homepage' => '',
124125
'visibility' => 'public',
126+
'private' => false,
125127
'has_issues' => false,
126128
'has_wiki' => false,
127129
'has_downloads' => false,
@@ -153,6 +155,7 @@ public function shouldCreateRepositoryWithInternalVisibility()
153155
'auto_init' => false,
154156
'has_projects' => true,
155157
'visibility' => 'internal',
158+
'private' => false,
156159
])
157160
->will($this->returnValue($expectedArray));
158161

@@ -372,6 +375,7 @@ public function shouldCreateUsingAllParams()
372375
'description' => 'test',
373376
'homepage' => 'http://l3l0.eu',
374377
'visibility' => 'private',
378+
'private' => true,
375379
'has_issues' => false,
376380
'has_wiki' => false,
377381
'has_downloads' => false,

0 commit comments

Comments
 (0)