fix: support headless Gitea credentials

This commit is contained in:
Dobromir Popov
2026-07-17 10:47:15 +03:00
parent ab466ce6b6
commit efd1cf4ef6

View File

@@ -31,6 +31,13 @@ STATUS_LABELS = {
def credential_for(host: str) -> tuple[str, str]: def credential_for(host: str) -> tuple[str, str]:
# Prefer explicitly injected process credentials for headless workers. They
# are never written to the repo or emitted in logs.
username = os.environ.get("GITEA_USERNAME")
password = os.environ.get("GITEA_TOKEN") or os.environ.get("GITEA_PASSWORD")
if password:
return username or "", password
result = subprocess.run( result = subprocess.run(
["git", "credential", "fill"], ["git", "credential", "fill"],
input=f"protocol=https\nhost={host}\n\n", input=f"protocol=https\nhost={host}\n\n",