|
|
|
@@ -44,7 +44,6 @@ __pycache__/
|
|
|
|
.vscode/
|
|
|
|
.vscode/
|
|
|
|
.idea/
|
|
|
|
.idea/
|
|
|
|
*.log
|
|
|
|
*.log
|
|
|
|
.env
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
with open(".gitignore", "w") as f:
|
|
|
|
with open(".gitignore", "w") as f:
|
|
|
|
f.write(content.strip())
|
|
|
|
f.write(content.strip())
|
|
|
|
@@ -55,9 +54,13 @@ __pycache__/
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
clone_url = None
|
|
|
|
clone_url = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize session and disable proxy
|
|
|
|
|
|
|
|
session = requests.Session()
|
|
|
|
|
|
|
|
session.trust_env = False
|
|
|
|
|
|
|
|
|
|
|
|
# 1. Create Repository via API
|
|
|
|
# 1. Create Repository via API
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
response = requests.post(API_URL, auth=AUTH, json=REPO_DATA)
|
|
|
|
response = session.post(API_URL, auth=AUTH, json=REPO_DATA)
|
|
|
|
if response.status_code == 201:
|
|
|
|
if response.status_code == 201:
|
|
|
|
print("Repository created successfully")
|
|
|
|
print("Repository created successfully")
|
|
|
|
clone_url = response.json()['clone_url']
|
|
|
|
clone_url = response.json()['clone_url']
|
|
|
|
@@ -67,7 +70,7 @@ def main():
|
|
|
|
user = AUTH[0]
|
|
|
|
user = AUTH[0]
|
|
|
|
repo_name = REPO_DATA["name"]
|
|
|
|
repo_name = REPO_DATA["name"]
|
|
|
|
get_url = f"https://git.aitosuv.com/api/v1/repos/{user}/{repo_name}"
|
|
|
|
get_url = f"https://git.aitosuv.com/api/v1/repos/{user}/{repo_name}"
|
|
|
|
resp_get = requests.get(get_url, auth=AUTH)
|
|
|
|
resp_get = session.get(get_url, auth=AUTH)
|
|
|
|
if resp_get.status_code == 200:
|
|
|
|
if resp_get.status_code == 200:
|
|
|
|
clone_url = resp_get.json()['clone_url']
|
|
|
|
clone_url = resp_get.json()['clone_url']
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
@@ -129,12 +132,12 @@ def main():
|
|
|
|
# We can try checking current branch name.
|
|
|
|
# We can try checking current branch name.
|
|
|
|
current_branch = run_command("git rev-parse --abbrev-ref HEAD")
|
|
|
|
current_branch = run_command("git rev-parse --abbrev-ref HEAD")
|
|
|
|
if current_branch:
|
|
|
|
if current_branch:
|
|
|
|
if run_command(f"git push -u origin {current_branch}") is None:
|
|
|
|
if run_command(f"git push -u origin {current_branch} -f") is None:
|
|
|
|
print("Push failed.")
|
|
|
|
print("Push failed.")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# Fallback if we couldn't get branch name
|
|
|
|
# Fallback if we couldn't get branch name
|
|
|
|
if run_command("git push -u origin master") is None:
|
|
|
|
if run_command("git push -u origin master -f") is None:
|
|
|
|
run_command("git push -u origin main")
|
|
|
|
run_command("git push -u origin main -f")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|
|