scripts: default badge-data script to Gitea API.

Allow running update-badge-data.py locally without GITHUB_API_URL and GITHUB_REPOSITORY; CI env vars still override.
This commit is contained in:
niklascfw 2026-06-13 12:38:09 +02:00
parent 7befa92a49
commit 97e6da2d33
No known key found for this signature in database

View file

@ -19,6 +19,8 @@ BADGE_PATH = os.path.join(
"badges",
"data.json",
)
DEFAULT_API_URL = "https://git.niklascfw.de/api/v1"
DEFAULT_REPOSITORY = "OmniNX/OmniNX"
def api_get(url: str, token: str) -> bytes:
@ -141,15 +143,11 @@ def update_download_lifetime(current: int, snapshot: int | None, lifetime: int |
def main() -> int:
api_base = os.environ.get("GITHUB_API_URL", "").rstrip("/")
repo = os.environ.get("GITHUB_REPOSITORY", "")
api_base = os.environ.get("GITHUB_API_URL", DEFAULT_API_URL).rstrip("/")
repo = os.environ.get("GITHUB_REPOSITORY", DEFAULT_REPOSITORY)
fw_repo = os.environ.get("FIRMWARE_REPOSITORY", "OmniNX/NX_Firmware").strip()
token = os.environ.get("GITHUB_TOKEN", "")
if not api_base or not repo:
print("GITHUB_API_URL und GITHUB_REPOSITORY werden benötigt.", file=sys.stderr)
return 1
try:
omninx_releases = fetch_releases(api_base, repo, token)
except urllib.error.HTTPError as e: