Skip to content

Commit ddb8fe1

Browse files
authored
Merge pull request #155 from GeekMasher/github-org-remove
Add flag to remove/include github default orgs
2 parents 9421c32 + a4b9abf commit ddb8fe1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ghastoolkit/octokit/enterprise.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ def __init__(
7575
self.enterprise = enterprise or GitHub.enterprise
7676
self.rest = RestRequest(GitHub.repository)
7777

78-
def getOrganizations(self) -> List[Organization]:
78+
def getOrganizations(self, include_github: bool = False) -> List[Organization]:
7979
"""Get all the Organizations in an enterprise.
8080
8181
You will need to be authenticated as an enterprise owner to use this API.
8282
"""
83+
github_orgs = ["github", "actions"]
8384
organizations = []
8485
url = Octokit.route("/organizations", GitHub.repository)
8586
# pagination uses a different API versus the rest of the API
@@ -102,6 +103,8 @@ def getOrganizations(self) -> List[Organization]:
102103
return []
103104

104105
for org in result:
106+
if not include_github and org.get("login") in github_orgs:
107+
continue
105108
organizations.append(Organization(org.get("login"), org.get("id")))
106109

107110
if len(result) < 100:

0 commit comments

Comments
 (0)