Initial commit
This commit is contained in:
parent
2cadd1a78a
commit
c98bc7ef38
|
|
@ -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!")
|
||||
Loading…
Reference in New Issue