@@ -48,34 +48,21 @@ def main(bucket_name: str, repo_name: str):
4848
4949 cwd = os .getcwd ()
5050 print ("Current working directory:" , cwd )
51-
52- spec_dir = f"{ repo_name } /Specification"
53-
54- print (f"[INFO] Checking for Specification folder at: { spec_dir } " )
55-
56- if not spec_dir .exists ():
57- print ("[SKIP] No Specification folder found — skipping all processing." )
58- return 0
59-
60- yaml_files = list (spec_dir .glob ("*.yaml" )) + list (spec_dir .glob ("*.yml" ))
6151
62- if not yaml_files :
63- print ("[SKIP] Specification folder exists, but no YAML files found — skipping." )
64- return 0
65-
66- output_dir = Path ("spec_output" )
67- output_dir .mkdir (exist_ok = True )
68-
69- generated_files = []
52+ os .chdir (working_directory )
53+ cmdNew = os .getcwd ()
54+ print ("New working directory:" , cmdNew )
55+
56+ #spec_dir = f"{repo_name}/Specification"
7057
71- print (f"[INFO] Found { len ( yaml_files ) } YAML file(s). Converting... " )
58+ # print(f"[INFO] Checking for Specification folder at: {spec_dir} ")
7259
73- for yaml_file in yaml_files :
74- json_file = convert_yaml_to_json ( yaml_file , output_dir )
75- generated_files . append ( json_file )
60+ #if not spec_dir.exists() :
61+ # print("[SKIP] No Specification folder found — skipping all processing." )
62+ # return 0
7663
77- print ( f"[INFO] Uploading { len ( generated_files ) } file(s) to S3 bucket ' { bucket_name } '..." )
78- for json_file in generated_files :
64+ json_file = list ( Path ( working_directory ). glob ( "*.json" ) )
65+ if json_file :
7966 upload_to_s3 (json_file , bucket_name , repo_name )
8067
8168 print ("[DONE] Processing complete." )
@@ -85,12 +72,14 @@ def main(bucket_name: str, repo_name: str):
8572if __name__ == "__main__" :
8673 print ("Hitting main" )
8774 if len (sys .argv ) != 3 :
88- print ("Usage: python copy_spec_to_s3.py <s3_bucket_name> <repo_name>" )
75+ print ("Usage: python copy_spec_to_s3.py <s3_bucket_name> <repo_name> <Working Directory> " )
8976 sys .exit (1 )
9077
9178 bucket_name = sys .argv [1 ]
9279 repo_name = sys .argv [2 ]
80+ working_directory = sys .argv [3 ]
9381 print (f"Repo name: { repo_name } " )
9482 print (f"Bucket name: { bucket_name } " )
83+ print (f"Working Directory: { working_directory } " )
9584
9685 sys .exit (main (bucket_name ,repo_name ))
0 commit comments