Drop stale webhook-relay lineage leftovers (superseded on master)

This commit is contained in:
2026-09-18 23:19:06 +00:00
parent ee0a2f39e9
commit a8e5c200dc
2 changed files with 5 additions and 57 deletions
-48
View File
@@ -1,48 +0,0 @@
#!/usr/bin/env python3
"""Keep external comments on the agent's own Gitea pull requests."""
from __future__ import annotations
import json
import os
import sys
AGENT_USERNAME = os.environ.get("GITEA_AGENT_USERNAME", "luna")
def login(user: object) -> str:
if not isinstance(user, dict):
return ""
return str(user.get("login") or user.get("username") or "")
def main() -> int:
try:
payload = json.load(sys.stdin)
except (json.JSONDecodeError, OSError):
return 1
if not isinstance(payload, dict):
return 1
pull_request = payload.get("pull_request")
comment = payload.get("comment")
if not isinstance(pull_request, dict) or not isinstance(comment, dict):
# Fail closed: only PR comment payloads for the agent's own PRs should
# wake the route.
return 0
if login(pull_request.get("user")) != AGENT_USERNAME:
return 0
# Do not wake Hermes for its own reply, which would otherwise create a
# comment -> run -> comment loop.
if login(comment.get("user")) == AGENT_USERNAME:
return 0
json.dump(payload, sys.stdout, ensure_ascii=False, separators=(",", ":"))
sys.stdout.write("\n")
return 0
if __name__ == "__main__":
raise SystemExit(main())