File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
main/java/org/kohsuke/github
test/java/org/kohsuke/github Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,18 @@ public GHCreateRepositoryBuilder gitignoreTemplate(String language) throws IOExc
98
98
return with ("gitignore_template" , language );
99
99
}
100
100
101
+ /**
102
+ * Include all branches when creating from a template repository
103
+ *
104
+ * @param includeAllBranches
105
+ * whether or not to include all branches from the template repository
106
+ * @return a builder to continue with building
107
+ * @throws IOException
108
+ */
109
+ public GHCreateRepositoryBuilder includeAllBranches (boolean includeAllBranches ) throws IOException {
110
+ return with ("include_all_branches" , includeAllBranches );
111
+ }
112
+
101
113
/**
102
114
* Desired license template to apply.
103
115
*
Original file line number Diff line number Diff line change @@ -264,6 +264,37 @@ public void testCreateRepositoryWithTemplateAndGHRepository() throws IOException
264
264
265
265
}
266
266
267
+ /**
268
+ * Test create a repository from a template with all branches included
269
+ *
270
+ * @throws IOException
271
+ * Signals that an I/O exception has occurred.
272
+ * @throws InterruptedException
273
+ * Signals that Thread.sleep() was interrupted
274
+ */
275
+
276
+ @ Test
277
+ public void testCreateRepositoryWithTemplateAndIncludeAllBranches () throws IOException , InterruptedException {
278
+ cleanupRepository (GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST );
279
+
280
+ GHOrganization org = gitHub .getOrganization (GITHUB_API_TEST_ORG );
281
+ GHRepository templateRepository = org .getRepository (GITHUB_API_TEMPLATE_TEST );
282
+
283
+ GHRepository repository = gitHub .createRepository (GITHUB_API_TEST )
284
+ .fromTemplateRepository (templateRepository )
285
+ .includeAllBranches (true )
286
+ .owner (GITHUB_API_TEST_ORG )
287
+ .create ();
288
+
289
+ assertThat (repository , notNullValue ());
290
+
291
+ // give it a moment for branches to be created
292
+ Thread .sleep (1500 );
293
+
294
+ assertThat (repository .getBranches ().keySet (), equalTo (templateRepository .getBranches ().keySet ()));
295
+
296
+ }
297
+
267
298
/**
268
299
* Test create team.
269
300
*
You can’t perform that action at this time.
0 commit comments