INNER CODE UNIT · Python
upsert_comment
RockxyApp/Rockxy · .github/tools/cla_gate.py:128
def upsert_comment(self, issue_number: int, body: str) -> None:
existing = self.find_marker_comment(issue_number)
if existing is not None:
if (existing.get("body") or "") == body:
return
status, _ = self._request(
"PATCH", f"/repos/{self._repo}/issues/comments/{existing['id']}", {"body": body}
)
if status != 200:
raise RuntimeError(f"failed to update gate comment: HTTP {status}")
return
status, _ = self._request(
"POST", f"/repos/{self._repo}/issues/{issue_number}/comments", {"body": body}
)
if status not in (200, 201):
raise RuntimeError(f"failed to post gate comment: HTTP {status}")
def get_default_branch_head_sha(self, default_branch: str) -> str: