fix(push): link branch ref in title as inline code

This commit is contained in:
RhenCloud 2026-08-16 23:54:02 +08:00
parent 3bcc98efc8
commit 2975087262
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
3 changed files with 5 additions and 3 deletions

View file

@ -116,7 +116,7 @@ export function formatPush(
count, count,
s: count !== 1 ? "s" : "", s: count !== 1 ? "s" : "",
repo: repo ?? t("common.repository"), repo: repo ?? t("common.repository"),
ref, ref: isTagPush ? tagLink(baseUrl, rawRef, ref) : branchLink(baseUrl, rawRef, ref),
}), }),
url: compareUrl, url: compareUrl,
color: GITHUB_COLORS.push, color: GITHUB_COLORS.push,

View file

@ -18,7 +18,7 @@ exports[`formatter snapshots push 1`] = `
], ],
"footer": "acme/widget", "footer": "acme/widget",
"timestamp": "TIMESTAMP", "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", "url": "https://github.com/acme/widget/compare/aaa...bbb",
} }
`; `;

View file

@ -32,7 +32,9 @@ describe("message title spec", () => {
sender, 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( expect(msg.description).toBe(
"[`abcd123`](https://github.com/acme/widget/commit/abcd1234ef) fix stuff", "[`abcd123`](https://github.com/acme/widget/commit/abcd1234ef) fix stuff",
); );