Spaces:
Sleeping
Sleeping
import os | |
import time | |
import shutil | |
# Get GitHub token from environment variables | |
gh_token = os.getenv("gh_token") | |
# URL with token for private repo access | |
url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/Adel_Flet_Demo.git" | |
# Clone the GitHub repository | |
os.system(f"git clone {url_with_token}") | |
# Sleep to ensure the clone operation is complete | |
time.sleep(10) | |
# Define the source and destination directories | |
source_dir = "Adel_Flet_Demo" | |
destination_dir = "." | |
# Move the contents of the Adel_Flet_Demo directory to the current directory | |
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) | |
# Remove the now empty Adel_Flet_Demo directory | |
os.rmdir(source_dir) | |
# Read and execute the main.py file | |
with open("main.py", "r") as file: | |
code = file.read() | |
exec(code) | |