Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from git import Repo
|
2 |
+
import os
|
3 |
+
|
4 |
+
# Retrieve the environment variables
|
5 |
+
GITHUB_PAT = os.getenv('GITHUB_PAT')
|
6 |
+
GIT_id = os.getenv('GIT_id')
|
7 |
+
GIT_repo = os.getenv('GIT_repo')
|
8 |
+
|
9 |
+
if GITHUB_PAT:
|
10 |
+
print("GITHUB_PAT set")
|
11 |
+
|
12 |
+
# Ensure the cloned_repo directory does not already exist
|
13 |
+
if not os.path.exists('cloned_repo'):
|
14 |
+
# Clone the repository using the Personal Access Token for authentication
|
15 |
+
Repo.clone_from(f'https://{GIT_id}:{GITHUB_PAT}@github.com/{GIT_id}/{GIT_repo}.git', './cloned_repo')
|
16 |
+
|
17 |
+
# Import the main module from the cloned repository
|
18 |
+
import cloned_repo.main as main
|
19 |
+
from cloned_repo.main import *
|