From 297508726293c3e723a5996549cdb3f5c81ff43a Mon Sep 17 00:00:00 2001 From: RhenCloud Date: Sun, 16 Aug 2026 23:54:02 +0800 Subject: [PATCH] fix(push): link branch ref in title as inline code --- server/lib/formatters/push.ts | 2 +- tests/__snapshots__/formatter-snapshot.test.ts.snap | 2 +- tests/formatter.test.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/lib/formatters/push.ts b/server/lib/formatters/push.ts index f4a542d..6d9859b 100644 --- a/server/lib/formatters/push.ts +++ b/server/lib/formatters/push.ts @@ -116,7 +116,7 @@ export function formatPush( count, s: count !== 1 ? "s" : "", repo: repo ?? t("common.repository"), - ref, + ref: isTagPush ? tagLink(baseUrl, rawRef, ref) : branchLink(baseUrl, rawRef, ref), }), url: compareUrl, color: GITHUB_COLORS.push, diff --git a/tests/__snapshots__/formatter-snapshot.test.ts.snap b/tests/__snapshots__/formatter-snapshot.test.ts.snap index bf3f710..665d2d4 100644 --- a/tests/__snapshots__/formatter-snapshot.test.ts.snap +++ b/tests/__snapshots__/formatter-snapshot.test.ts.snap @@ -18,7 +18,7 @@ exports[`formatter snapshots push 1`] = ` ], "footer": "acme/widget", "timestamp": "TIMESTAMP", - "title": "acme/widget: Pushed 1 commit to main", + "title": "acme/widget: Pushed 1 commit to [\`main\`](https://github.com/acme/widget/tree/main)", "url": "https://github.com/acme/widget/compare/aaa...bbb", } `; diff --git a/tests/formatter.test.ts b/tests/formatter.test.ts index 9865669..8a20c5f 100644 --- a/tests/formatter.test.ts +++ b/tests/formatter.test.ts @@ -32,7 +32,9 @@ describe("message title spec", () => { sender, }), ); - expect(msg.title).toBe("acme/widget: Pushed 1 commit to main"); +expect(msg.title).toBe( + "acme/widget: Pushed 1 commit to [`main`](https://github.com/acme/widget/tree/main)", + ); expect(msg.description).toBe( "[`abcd123`](https://github.com/acme/widget/commit/abcd1234ef) fix stuff", );