Skip to content

Commit 0c22815

Browse files
authored
Merge pull request #872 from MarcosCela/doc/org-level-resources
Add documentation for organization-level resources
2 parents 0ca792e + 50dd8f5 commit 0c22815

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Creating resources at the organization level
2+
3+
In order to create resources in GitHub for a given organization, you must first create an object of type <<<GHOrganization>>>.
4+
As an example:
5+
6+
+-----+
7+
GHOrganization organizationClient(GitHub gitHub, String organizationName) throws IOException {
8+
return gitHub.getOrganization(organizationName);
9+
}
10+
+-----+
11+
12+
Now you can easily work with the GHOrganization, and all methods that will create resources will create them
13+
in the given organization.
14+
15+
One of the most common use cases is to create a repository in a given organization:
16+
17+
+-----+
18+
void createRepository(GHOrganization organization) {
19+
organization.createRepository("repository-name")
20+
.private_(true)
21+
.wiki(false)
22+
.projects(false)
23+
.description("Description")
24+
.allowMergeCommit(true)
25+
.allowSquashMerge(false)
26+
.allowRebaseMerge(false)
27+
.create()
28+
}
29+
+-----+
30+
31+

src/site/site.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<item name="JWT Authentication" href="/githubappjwtauth.html"/>
2424
<item name="App Installation Token " href="/githubappappinsttokenauth.html"/>
2525
</item>
26+
<item name="Working with organizations" href="/createorglevelresources.html"/>
2627
</menu>
2728

2829
<menu name="References">

0 commit comments

Comments
 (0)