Checkpoint: 2026-04-04 16:00:03 UTC

This commit is contained in:
2026-04-04 16:00:04 +00:00
parent 053e10c08d
commit 589e45f299
2 changed files with 18 additions and 0 deletions

View File

@@ -90,6 +90,12 @@ def api_post(path, data):
with urllib.request.urlopen(req, timeout=15) as resp:
return json.loads(resp.read().decode())
def api_patch(path, data):
body = json.dumps(data).encode()
req = urllib.request.Request(f"{GITEA}/api/v1{path}", data=body, headers=HEADERS, method="PATCH")
with urllib.request.urlopen(req, timeout=15) as resp:
return json.loads(resp.read().decode())
# === COMMON OPERATIONS ===
# List repos
@@ -133,6 +139,17 @@ issue = api_get("/repos/OWNER/REPO/issues/NUMBER")
api_post("/repos/OWNER/REPO/issues/NUMBER/comments", {
"body": "Comment text"
})
# Close an issue (or reopen with state="open")
api_patch("/repos/OWNER/REPO/issues/NUMBER", {
"state": "closed"
})
# Update issue fields (title, body, assignees, labels, milestone)
api_patch("/repos/OWNER/REPO/issues/NUMBER", {
"title": "Updated title",
"assignees": ["user1"]
})
```
## Pitfalls