From 3f2932e76dc9a08642340a1e78efec1a2f8ebf0e Mon Sep 17 00:00:00 2001 From: banteg <4562643+banteg@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:32:15 +0400 Subject: [PATCH] fix(ci): link pr numbers in commit notifications (#145) --- scripts/commit_notify.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/commit_notify.py b/scripts/commit_notify.py index 73ea13b..47ac2cf 100644 --- a/scripts/commit_notify.py +++ b/scripts/commit_notify.py @@ -32,6 +32,7 @@ if not commits and head_commit: commits = [head_commit] PULL_RE = re.compile(rf"(https://github.com/{repo}/pull/(\d+))") +PULL_NUM_RE = re.compile(r"\(#(\d+)\)") def _short_sha(value: str) -> str: @@ -43,6 +44,9 @@ def _commit_line(commit: dict[str, object]) -> str: sha = _short_sha(full_sha) message = str(commit.get("message") or "").splitlines()[0].strip() message = PULL_RE.sub(r"[#\2](\1)", message) + message = PULL_NUM_RE.sub( + rf"([#\1](https://github.com/{repo}/pull/\1))", message + ) url = f"https://github.com/{repo}/commit/{full_sha or sha}" return f"- [{sha}]({url}) {message}"