Compare commits

..

2 Commits

+18 -1
View File
@@ -21,6 +21,13 @@ import sys
import urllib.request
import urllib.error
# Fix Windows GBK encoding: emoji and Chinese characters from Gitea API
# crash print() under the default Windows code page.
try:
sys.stdout.reconfigure(encoding='utf-8')
except Exception:
pass
def _load_gitea_config():
"""Load Gitea URL, repo, and token from ~/.gitea/config.yaml or env vars."""
config_path = os.path.expanduser("~/.gitea/config.yaml")
@@ -173,7 +180,7 @@ def blocked_check():
print(f"Checked {len(all_blocked)} blocked issue(s): still blocked.")
def get_issue(num):
def get_issue(num, with_comments=True):
i = _req("GET", f"/issues/{num}")
print(f"## #{i['number']}: {i['title']}")
print(f"State: {i['state']}")
@@ -181,6 +188,16 @@ def get_issue(num):
print(f"Labels: {', '.join(labels) if labels else 'none'}")
print()
print(i.get("body", "(no description)"))
if with_comments:
comments = _req_safe("GET", f"/issues/{num}/comments")
if comments:
print(f"\n--- Comments ({len(comments)}) ---")
for c in comments:
user = c.get("user", {}).get("login", "unknown")
created = c.get("created_at", "")[:16]
body = c.get("body", "")
print(f"\n[{user}] {created}")
print(body)
return i