Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions commitbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,28 @@ def update():
os.system('type nul > a.txt')


def pull(repo,url):
if os.path.exists(repo)==False:
os.system('git clone ' + url)
def pull(repo, url, branch="main"):
if not os.path.exists(repo):
os.system(f'git clone -b {branch} {url}')
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, ''+repo)
filename = os.path.join(dirname, repo)
os.chdir(filename)

def push():
def push(branch="main"):
global count
os.system('cd')
os.system('git add . && git commit -m "commit ' + str(count) + '"')
os.system('git push origin master')
count+=1
os.system(f'git push origin {branch}')
count += 1

def main():
repo=input("Enter Git Repository name: ")
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):
branch = input("Enter Branch name (default: main): ") or "main"
comm = int(input("Enter Number Of Commits To Perform: "))
pull(repo, url, branch)
for _ in range(comm):
update()
push()
push(branch)


if __name__=='__main__':
main()
if __name__ == '__main__':
main()