@@ -70,31 +70,26 @@ def get_org_repos(self, org_name: str) -> list[Organization]:
7070 raise e
7171
7272 def save_organization_files (self , org_name : str , codeJSONPath ) -> None :
73- try :
74- org = self .github .get_organization (org_name )
75- total_repos = self .get_org_repos (org_name )
73+ raise NotImplementedError
7674
77- for id , repo in enumerate (org .get_repos (type = 'public' ), 1 ):
78- print (f"\n Saving codeJSON for { repo .name } [{ id } /{ total_repos } ]" )
79-
80- repoPath = os .path .join (codeJSONPath , (repo .name + '.json' ))
81- code_json = self .save_code_json (repo ,repoPath )
82- except GithubException as e :
83- print (f"Error processing organization { org_name } : { str (e )} " )
84-
85- def process_organization (self , org_name : str ) -> None :
75+ def process_organization (self , org_name : str , add_to_index = True , codeJSONPath = None ) -> None :
8676 try :
8777 org = self .github .get_organization (org_name )
8878 total_repos = self .get_org_repos (org_name )
8979
9080 for id , repo in enumerate (org .get_repos (type = 'public' ), 1 ):
9181 print (f"\n Checking { repo .name } [{ id } /{ total_repos } ]" )
9282
93- code_json = self .get_code_json (repo )
94- if code_json :
83+ if not codeJSONPath :
84+ code_json = self .get_code_json (repo )
85+ else :
86+ repoPath = os .path .join (codeJSONPath , (repo .name + '.json' ))
87+ code_json = self .save_code_json (repo ,repoPath )
88+
89+ if code_json and add_to_index :
9590 print (f"✅ Found code.json in { repo .name } " )
9691 self .update_index (self .index , code_json , org_name , repo .name )
97- else :
92+ elif not code_json :
9893 print (f"❌ No code.json found in { repo .name } " )
9994
10095 except GithubException as e :
0 commit comments