Skip to content

Commit 276a76a

Browse files
committed
fix(depgraph): Fix issues with pulling org level dependencies
1 parent 916e4ea commit 276a76a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ghastoolkit/octokit/dependencygraph.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,24 @@ def getOrganizationDependencies(
7373
Dict[Repository, Dependencies]: A dictionary of repositories and their dependencies.
7474
"""
7575
org = Organization(organization=owner or GitHub.owner)
76+
logger.debug(f"Processing organization :: {org}")
7677

7778
deps: Dict[Repository, Dependencies] = {}
7879

7980
repositories = org.getRepositories()
80-
logger.debug(f"Found {len(repositories)} repositories in organization")
81+
logger.debug(f"Found `{len(repositories)}` repositories in organization")
8182

8283
for repo in repositories:
8384
logger.debug(f"Processing repository :: {repo}")
8485
try:
85-
self.rest = RestRequest(repo)
86+
depgraph = DependencyGraph(repo, enable_graphql=self.enable_graphql)
87+
logger.debug(f"Using repository :: {depgraph.repository}")
8688

87-
deps[repo] = self.getDependenciesSbom()
89+
deps[repo] = depgraph.getDependenciesSbom()
8890

89-
if self.enable_graphql:
91+
if depgraph.enable_graphql:
9092
logger.debug("Enabled GraphQL Dependencies")
91-
graph_deps = self.getDependenciesGraphQL()
93+
graph_deps = depgraph.getDependenciesGraphQL()
9294

9395
deps[repo].updateDependencies(graph_deps)
9496
logger.debug("Updated dependencies with GraphQL")
@@ -162,6 +164,7 @@ def getDependenciesSbom(self) -> Dependencies:
162164
f"Cache not found for {self.repository.repo}, downloading SBOM"
163165
)
164166

167+
logger.debug(f"Downloading SBOM for {self.repository}")
165168
spdx_bom = self.exportBOM()
166169

167170
if self.cache_enabled:
@@ -221,6 +224,10 @@ def getDependenciesGraphQL(self, dependencies_count: int = 100) -> Dependencies:
221224
has_next_page = True
222225

223226
while has_next_page:
227+
if not graph_manifests.get("edges"):
228+
logger.debug("No more manifests to be processed")
229+
break
230+
224231
for manifest in graph_manifests.get("edges", []):
225232
node = manifest.get("node", {})
226233

0 commit comments

Comments
 (0)