Skip to content

Commit f7c5329

Browse files
committed
Make rollup SHA easier to copy
1 parent aa540b7 commit f7c5329

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

site/src/github.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ pub async fn unroll_rollup(
2929
previous_master: &str,
3030
rollup_pr_number: u32,
3131
) -> Result<(), String> {
32+
let commit_link = |sha: &str| format!("https://github.com/rust-lang-ci/rust/commit/{sha}");
33+
3234
let format_commit = |s: &str, truncate: bool| {
3335
let display = truncate.then(|| s.split_at(10).0).unwrap_or(s);
34-
format!("[{display}](https://github.com/rust-lang-ci/rust/commit/{s})")
36+
format!("[{display}]({})", commit_link(s))
3537
};
3638

3739
// Sort rolled up commits by their PR number in ascending order, so that they have the
@@ -49,7 +51,11 @@ pub async fn unroll_rollup(
4951
let commit = c
5052
.sha
5153
.as_deref()
52-
.map(|s| format_commit(s, false))
54+
.map(|s| {
55+
// Format the SHA as a code block to make it easy to copy-paste verbatim
56+
let link = commit_link(s);
57+
format!("`{s}` ([link]({link}))")
58+
})
5359
.unwrap_or_else(|| {
5460
let head = format_commit(&c.rolled_up_head, true);
5561
format!("❌ conflicts merging '{head}' into previous master ❌")

0 commit comments

Comments
 (0)