From c98bc7ef387e5751bf576f969f74b211a9649fee Mon Sep 17 00:00:00 2001 From: Paul Huliganga Date: Sun, 12 Apr 2026 23:44:36 -0400 Subject: [PATCH] Initial commit --- create_gitea_repo.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 create_gitea_repo.py diff --git a/create_gitea_repo.py b/create_gitea_repo.py new file mode 100644 index 0000000..25c7838 --- /dev/null +++ b/create_gitea_repo.py @@ -0,0 +1,38 @@ +import os +import sys +import requests +import subprocess + +# --- Config --- +GITEA_URL = "https://paje.ca" +USERNAME = "paulh" +REPO = "donkeycar-rl-autoresearch" +TOKEN = "6e97da632ceaaf4bef8e070bd2e844089b3e680a" + +api_url = f"{GITEA_URL}/api/v1/user/repos" +git_url = f"{GITEA_URL}/{USERNAME}/{REPO}.git" + +# --- Create repo on Gitea --- +headers = {"Authorization": f"token {TOKEN}"} +data = { + "name": REPO, + "description": "Research-grade DonkeyCar RL autoresearch and sweep system.", + "private": False +} +r = requests.post(api_url, headers=headers, json=data) +if r.status_code == 201: + print("[OK] Created repo on Gitea:", git_url) +elif r.status_code == 409: + print("[NOTE] Repo already exists on Gitea:", git_url) +else: + print("[ERROR] Could not create repo:", r.status_code, r.text) + sys.exit(1) + +# --- Set git remote and push --- +try: + subprocess.check_call(["git", "remote", "remove", "origin"]) +except subprocess.CalledProcessError: + pass +subprocess.check_call(["git", "remote", "add", "origin", git_url]) +subprocess.check_call(["git", "push", "-u", "origin", "master"]) +print("[OK] Repo pushed to Gitea!")