Spaces:
Sleeping
Sleeping
| import os | |
| import time | |
| import shutil | |
| gh_token = os.getenv("gh_token") | |
| repo = "Genarabia-Live-Translator" | |
| url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/{repo}.git" | |
| # Clone repo | |
| exit_code = os.system(f"git clone {url_with_token}") | |
| if exit_code != 0: | |
| raise RuntimeError("❌ Failed to clone repo. Check your gh_token.") | |
| time.sleep(5) | |
| source_dir = repo | |
| destination_dir = "." | |
| if os.path.exists(source_dir): | |
| for item in os.listdir(source_dir): | |
| s = os.path.join(source_dir, item) | |
| d = os.path.join(destination_dir, item) | |
| shutil.move(s, d) | |
| os.rmdir(source_dir) | |
| print("✅ Repo setup complete") | |