Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
from git import Repo
|
2 |
import os
|
3 |
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
GITHUB_PAT = os.environ['GITHUB']
|
7 |
-
GIT_id = os.environ['GIT_id']
|
8 |
-
GIT_repo = os.environ['GIT_repo']
|
9 |
-
|
10 |
-
if GITHUB_PAT != []:
|
11 |
print("GITHUB_PAT set")
|
12 |
|
|
|
13 |
if not os.path.exists('cloned_repo'):
|
14 |
-
|
|
|
15 |
|
|
|
16 |
import cloned_repo.main as main
|
17 |
from cloned_repo.main import *
|
18 |
|
|
|
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 *
|
20 |
|