Show author info
All checks were successful
Tests / Declarative: Post Actions passed: 14
CI-Multi/pipeline/pr-main This commit looks good

This commit is contained in:
2026-02-22 13:38:30 +01:00
parent 9297bed50e
commit f2da39f0db
4 changed files with 128 additions and 12 deletions

View File

@@ -16,7 +16,8 @@
import base64
import html
from typing import Dict, List
import re
from typing import Dict, List, Tuple
import requests
@@ -50,9 +51,36 @@ def _extract_trigger(build: Dict) -> str:
return ""
def _summarize_trigger(trigger: str) -> Tuple[str, str, str]:
if not trigger:
return "", "", ""
pr_url = ""
for line in trigger.splitlines():
if line.strip().lower().startswith("reviewed-on:"):
pr_url = line.split(":", 1)[-1].strip()
break
author_match = re.search(r"\(([^)]+)\)\.", trigger)
author = author_match.group(1).strip() if author_match else ""
pr_match = re.search(r"#(\d+)", trigger)
title_match = re.search(r"Merge pull request '([^']+)'", trigger)
if pr_match:
pr_number = pr_match.group(1)
title = title_match.group(1).strip() if title_match else ""
if title:
return f"Merge PR #{pr_number} · {title}", pr_url, author
return f"Merge PR #{pr_number}", pr_url, author
return trigger.splitlines()[0].strip(), pr_url, author
def normalize_build(build: Dict) -> Dict:
commits = _extract_commits(build)
trigger = _extract_trigger(build)
trigger_label, trigger_url, trigger_author = _summarize_trigger(trigger)
status = (build.get("result") or "RUNNING").lower()
if build.get("building"):
status = "running"
@@ -65,6 +93,9 @@ def normalize_build(build: Dict) -> Dict:
"url": build.get("url"),
"commits": commits,
"trigger": trigger,
"trigger_label": trigger_label,
"trigger_url": trigger_url,
"trigger_author": trigger_author,
}