From bc93867eed5815ab9567f8e01f240a3b3f6b7b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Alexander=20R=C3=BCll?= Date: Mon, 24 Jan 2022 18:08:40 +0100 Subject: [PATCH 1/4] Boolean private needed to create private repo as seen in: https://docs.github.com/en/rest/reference/repos#create-an-organization-repository --- lib/Github/Api/Repo.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 4d8c012ff3e..12fe726b450 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -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, From a1f96868c572d01a99eeca93d21b56a24b90f09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Alexander=20R=C3=BCll?= Date: Mon, 7 Feb 2022 19:28:06 +0100 Subject: [PATCH 2/4] Fix tests --- test/Github/Tests/Api/RepoTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Github/Tests/Api/RepoTest.php b/test/Github/Tests/Api/RepoTest.php index a934bc6b906..7ba181dd53f 100644 --- a/test/Github/Tests/Api/RepoTest.php +++ b/test/Github/Tests/Api/RepoTest.php @@ -96,6 +96,7 @@ public function shouldCreateRepositoryUsingNameOnly() 'description' => '', 'homepage' => '', 'visibility' => 'public', + 'private' => false, 'has_issues' => false, 'has_wiki' => false, 'has_downloads' => false, @@ -122,6 +123,7 @@ public function shouldCreateRepositoryForOrganization() 'description' => '', 'homepage' => '', 'visibility' => 'public', + 'private' => false, 'has_issues' => false, 'has_wiki' => false, 'has_downloads' => false, @@ -153,6 +155,7 @@ public function shouldCreateRepositoryWithInternalVisibility() 'auto_init' => false, 'has_projects' => true, 'visibility' => 'internal', + 'private' => false, ]) ->will($this->returnValue($expectedArray)); @@ -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, From 11d92e73ab2d63e54410640fbf0d6cdbe292dcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Alexander=20R=C3=BCll?= Date: Wed, 13 Apr 2022 16:28:52 +0200 Subject: [PATCH 3/4] Fix issue --- lib/Github/Api/Repo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 12fe726b450..5760a587bed 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -206,7 +206,6 @@ public function create( 'description' => $description, 'homepage' => $homepage, 'private' => ($visibility ?? ($public ? 'public' : 'private')) === 'private', - 'visibility' => $visibility ?? ($public ? 'public' : 'private'), 'has_issues' => $hasIssues, 'has_wiki' => $hasWiki, 'has_downloads' => $hasDownloads, @@ -214,6 +213,10 @@ public function create( 'has_projects' => $hasProjects, ]; + if ($visibility) { + $parameters['visibility'] = $visibility; + } + if ($organization && $teamId) { $parameters['team_id'] = $teamId; } From d2780b50b0169c540ad5edee1b2c60a9831a01a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Alexander=20R=C3=BCll?= Date: Wed, 13 Apr 2022 16:35:18 +0200 Subject: [PATCH 4/4] Fix tests --- test/Github/Tests/Api/RepoTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/Github/Tests/Api/RepoTest.php b/test/Github/Tests/Api/RepoTest.php index 7ba181dd53f..9cfa7f84a88 100644 --- a/test/Github/Tests/Api/RepoTest.php +++ b/test/Github/Tests/Api/RepoTest.php @@ -95,7 +95,6 @@ public function shouldCreateRepositoryUsingNameOnly() 'name' => 'l3l0Repo', 'description' => '', 'homepage' => '', - 'visibility' => 'public', 'private' => false, 'has_issues' => false, 'has_wiki' => false, @@ -122,7 +121,6 @@ public function shouldCreateRepositoryForOrganization() 'name' => 'KnpLabsRepo', 'description' => '', 'homepage' => '', - 'visibility' => 'public', 'private' => false, 'has_issues' => false, 'has_wiki' => false, @@ -374,7 +372,6 @@ public function shouldCreateUsingAllParams() 'name' => 'l3l0Repo', 'description' => 'test', 'homepage' => 'http://l3l0.eu', - 'visibility' => 'private', 'private' => true, 'has_issues' => false, 'has_wiki' => false,