#!/usr/bin/env python3 # SPDX-License-Identifier: MIT """Publish measured toolkit badges to the private Gitea badge branch.""" import os from pathlib import Path from badge_store import publish_file ROOT = Path(__file__).resolve().parents[1] NAMES = ("tests", "coverage", "bench", "bench-coverage", "loc", "dependencies", "quality", "license") def main() -> None: api = os.environ["GITHUB_API_URL"].rstrip("/") repo = os.environ["GITHUB_REPOSITORY"] token = os.environ["GITEA_TOKEN"] for name in NAMES: data = (ROOT / "badges" / f"{name}.svg").read_bytes() if not data.lstrip().startswith(b"