-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitbot.py
More file actions
45 lines (36 loc) · 1.07 KB
/
commitbot.py
File metadata and controls
45 lines (36 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from time import sleep
import os
count=1
def update():
if 'test1.txt' in os.listdir():
os.system('rename test1.txt test2.txt') #Renames file
elif 'test2.txt' in os.listdir():
os.system('rename test2.txt test1.txt') #Renames file
else:
listdir=os.listdir()
for list in listdir:
if list != '.git':
os.system('del '+ list)
os.system('type nul > test1.txt')
def pull(repo,url):
if os.path.exists(repo)==False:
os.system('git clone ' + url)
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, ''+repo)
os.chdir(filename)
def push():
global count
os.system('cd')
os.system('git add . && git commit -m "commit ' + str(count) + '"')
os.system('git push origin main')
count+=1
def main():
repo=input("Enter Git Repository name: ")
url = input("Enter Git Repository URL: ")
comm=int(input("Enter Number Of Commits To Perform: "))
pull(repo,url)
for i in range(0,comm):
update()
push()
if __name__=='__main__':
main()