Skip to content

Commit abab51c

Browse files
committed
Make rollup SHA easier to copy
1 parent b2e5ef8 commit abab51c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

site/src/github.rs

+8-2
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
@@ -52,7 +54,11 @@ pub async fn unroll_rollup(
5254
let commit = c
5355
.sha
5456
.as_deref()
55-
.map(|s| format_commit(s, false))
57+
.map(|s| {
58+
// Format the SHA as a code block to make it easy to copy-paste verbatim
59+
let link = commit_link(s);
60+
format!("`{s}` ([link]({link}))")
61+
})
5662
.unwrap_or_else(|| {
5763
let head = format_commit(&c.rolled_up_head, true);
5864
format!("❌ conflicts merging '{head}' into previous master ❌")

0 commit comments

Comments
 (0)