Clean and add extra handlers

This commit is contained in:
KenwoodFox
2026-06-29 12:18:48 -04:00
parent 25bda28e28
commit 69bb4319dd
2 changed files with 12 additions and 5 deletions

View File

@@ -318,6 +318,17 @@ def publish_file(path: Path, cfg: Config) -> None:
print(f" {path.name} already published (409); skipping "
f"(use --replace to overwrite)")
return
if status in (401, 403):
raise RuntimeError(
f"upload of {path.name} failed: HTTP {status}: "
f"{body.strip()[:200]}\n"
f" -> The registry rejected the credentials for owner "
f"'{cfg.owner}'.\n"
f" Gitea's automatic Actions token (github.token / "
f"GITEA_TOKEN) cannot write packages.\n"
f" Use a Personal Access Token with the 'write:package' scope "
f"(set PACKAGE_TOKEN / --token)."
)
raise RuntimeError(
f"upload of {path.name} failed: HTTP {status}: {body.strip()[:500]}"
)