@@ -70,31 +70,26 @@ def get_org_repos(self, org_name: str) -> list[Organization]:
70
70
raise e
71
71
72
72
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
76
74
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 :
86
76
try :
87
77
org = self .github .get_organization (org_name )
88
78
total_repos = self .get_org_repos (org_name )
89
79
90
80
for id , repo in enumerate (org .get_repos (type = 'public' ), 1 ):
91
81
print (f"\n Checking { repo .name } [{ id } /{ total_repos } ]" )
92
82
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 :
95
90
print (f"✅ Found code.json in { repo .name } " )
96
91
self .update_index (self .index , code_json , org_name , repo .name )
97
- else :
92
+ elif not code_json :
98
93
print (f"❌ No code.json found in { repo .name } " )
99
94
100
95
except GithubException as e :
0 commit comments