ZaaachX commited on
Commit
b83b4b4
·
1 Parent(s): ab196a4

init commit

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. app.py +34 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from git import Repo
2
+ import os
3
+ import subprocess
4
+ import sys
5
+
6
+
7
+ GITHUB_PAT = os.getenv('GITHUB_PAT')
8
+ GIT_USER = os.getenv('GIT_USER')
9
+ GIT_REPO = os.getenv('GIT_REPO')
10
+
11
+ if GITHUB_PAT:
12
+ print("GITHUB_PAT set")
13
+
14
+ if not os.path.exists('cloned_repo'):
15
+ Repo.clone_from(f'https://{GIT_USER}:{GITHUB_PAT}@github.com/{GIT_USER}/{GIT_REPO}.git', './cloned_repo')
16
+
17
+ # Install Python dependencies
18
+ subprocess.run(['pip', 'install', '-r', 'cloned_repo/requirements.txt'])
19
+
20
+
21
+ # Install system-level dependencies if packages.txt exists
22
+ if os.path.exists('cloned_repo/packages.txt'):
23
+ with open('cloned_repo/packages.txt') as f:
24
+ packages = f.read().splitlines()
25
+ if packages:
26
+ subprocess.run(['apt-get', 'update'])
27
+ subprocess.run(['apt-get', 'install', '-y'] + packages)
28
+
29
+ sys.path.insert(0, os.path.abspath('cloned_repo'))
30
+
31
+ # Now you can import your modules correctly
32
+ import main
33
+
34
+ main.main()