Awesome-Python-Scripts/git_automation/create.py
loge1998 27f2a0e8b6
Added git automation to repo (#171)
Added gitAutomation to README.md

refactoring
2020-10-05 13:37:25 +05:30

25 lines
620 B
Python
Executable File

import sys
import os
from github import Github
from dotenv import load_dotenv
load_dotenv()
path = os.getenv("FILEPATH")
username = os.getenv("USERNAME")
password = os.getenv("PASSWORD")
def create():
folderName = str(sys.argv[1])
folderpath = os.path.join(path,folderName)
if os.path.exists(folderpath):
print("Folder already exists.. Link to the path - "+ folderpath)
os.makedirs(folderpath)
user = Github(username, password).get_user()
repo = user.create_repo(sys.argv[1])
print("Succesfully created repository {}".format(sys.argv[1]))
if __name__ == "__main__":
create()