@@ -200,11 +200,11 @@ def run(cmd, cwd=None):
200
200
def clone_repo (repo , branch = "demo-1" ):
201
201
"""
202
202
Clone a repository and checkout a specific branch
203
-
203
+
204
204
Args:
205
205
repo (str): Repository name to clone
206
206
branch (str): Branch name to checkout (default: demo-1)
207
-
207
+
208
208
Returns:
209
209
str: Repository directory name
210
210
"""
@@ -239,9 +239,9 @@ def clone_repo(repo, branch="demo-1"):
239
239
run (["git" , "fetch" ], cwd = repo )
240
240
# Check if the branch exists remotely
241
241
result = subprocess .run (
242
- ["git" , "ls-remote" , "--heads" , "origin" , branch ],
243
- cwd = repo ,
244
- capture_output = True ,
242
+ ["git" , "ls-remote" , "--heads" , "origin" , branch ],
243
+ cwd = repo ,
244
+ capture_output = True ,
245
245
text = True
246
246
)
247
247
if branch in result .stdout :
@@ -397,7 +397,7 @@ def create_env_files(repo_dir, config_dict):
397
397
398
398
This function creates .env files in each repository with the necessary
399
399
environment variables such as GitHub tokens and HackMD API tokens.
400
-
400
+
401
401
Args:
402
402
repo_dir: Repository directory path
403
403
config_dict: Configuration dictionary containing environment variables
@@ -408,29 +408,29 @@ def create_env_files(repo_dir, config_dict):
408
408
# Check if the config has env settings
409
409
if 'env' not in config_dict :
410
410
return None
411
-
411
+
412
412
env_path = Path (repo_dir ) / ".env"
413
413
env_content = []
414
-
414
+
415
415
# Create or read existing .env file
416
416
if env_path .exists ():
417
417
with open (env_path , 'r' ) as f :
418
418
env_content = f .readlines ()
419
419
# Remove trailing newlines
420
420
env_content = [line .rstrip () for line in env_content ]
421
-
421
+
422
422
# Get global.env to extract token values
423
423
global_env_path = Path (__file__ ).parent / "global.env"
424
424
global_env_vars = {}
425
-
425
+
426
426
if global_env_path .exists ():
427
427
with open (global_env_path , 'r' ) as f :
428
428
for line in f :
429
429
line = line .strip ()
430
430
if line and not line .startswith ('#' ) and '=' in line :
431
431
key , value = line .split ('=' , 1 )
432
432
global_env_vars [key ] = value
433
-
433
+
434
434
# Process environment variables from the config
435
435
for env_var_name , env_var_key in config_dict ['env' ].items ():
436
436
# Check if the env var already exists in the .env file
@@ -442,18 +442,18 @@ def create_env_files(repo_dir, config_dict):
442
442
env_content [i ] = f"{ env_var_key } ={ global_env_vars [env_var_key ]} "
443
443
var_exists = True
444
444
break
445
-
445
+
446
446
# Add new entry if it doesn't exist
447
447
if not var_exists :
448
448
# Use value from global.env if available
449
449
value = global_env_vars .get (env_var_key , "" )
450
450
env_content .append (f"{ env_var_key } ={ value } " )
451
-
451
+
452
452
# Write the updated .env file
453
453
with open (env_path , 'w' ) as f :
454
454
for line in env_content :
455
455
f .write (line + '\n ' )
456
-
456
+
457
457
console .print (f"[bold green]Created/updated .env file at { env_path } [/bold green]" )
458
458
return env_path
459
459
@@ -652,10 +652,13 @@ def main(is_docker=False, branch="demo-1"):
652
652
cache_path = config_dict ["koi_net" ]["cache_directory_path" ]
653
653
first_contact = config_dict ["koi_net" ].get ("first_contact" , "" )
654
654
config_path = write_full_config (repo_dir , config_dict )
655
- install_requirements (repo_dir )
656
-
655
+ if not is_docker :
656
+ install_requirements (repo_dir )
657
+ else :
658
+ console .print (f"[bold yellow]Skipping dependency installation for { repo_dir } (Docker mode)[/bold yellow]" )
659
+
657
660
# Create or update .env file for the repository
658
- env_path = create_env_files (repo_dir , config_dict )
661
+ create_env_files (repo_dir , config_dict )
659
662
660
663
# Generate Dockerfile if in Docker mode
661
664
if is_docker :
@@ -678,7 +681,7 @@ def main(is_docker=False, branch="demo-1"):
678
681
first_contact or "-"
679
682
)
680
683
681
- console .print (f "\n All repos cloned, config.yaml written, and requirements installed with standard pip/venv.\n " )
684
+ console .print ("\n All repos cloned and config.yaml written. Requirements installed with standard pip/venv (skipped under Docker mode) .\n " )
682
685
console .print (table )
683
686
684
687
console .print ("\n [bold cyan]Port Configuration (All Modes):[/bold cyan]" )
0 commit comments