Skip to content

Commit 4a58d49

Browse files
Move triage comment to higher in the message
1 parent 803ece7 commit 4a58d49

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

site/src/github/comparison_summary.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,22 @@ async fn summarize_run(
134134
) -> Result<String, String> {
135135
let benchmark_map = ctxt.get_benchmark_category_map().await;
136136

137-
let mut message = format!(
137+
let mut message = String::new();
138+
if let PerfRunSource::TriageBuild(build) = &source {
139+
write!(
140+
&mut message,
141+
"> [!NOTE]\n> This PR was benchmarked as part of triage of its containing rollup: [triage URL](/rust-lang/rust/pull/{}#issuecomment-{}).\n\n",
142+
build.rollup_pr_number,
143+
build.triage_comment.full_database_id
144+
).unwrap();
145+
}
146+
147+
write!(
148+
&mut message,
138149
"Finished benchmarking commit ({sha}): [comparison URL]({comparison_url}).\n\n",
139150
sha = commit.sha,
140151
comparison_url = make_comparison_url(&commit, Metric::InstructionsUser)
141-
);
152+
).unwrap();
142153

143154
let inst_comparison =
144155
calculate_metric_comparison(ctxt, &commit, Metric::InstructionsUser).await?;
@@ -191,8 +202,9 @@ async fn summarize_run(
191202

192203
let next_steps = match &source {
193204
PerfRunSource::TryBuild => try_run_body(is_regression, deserves_attention),
194-
PerfRunSource::MasterCommit => master_run_body(is_regression),
195-
PerfRunSource::TriageBuild(triage_build) => triage_run_body(triage_build, is_regression),
205+
PerfRunSource::MasterCommit | PerfRunSource::TriageBuild(..) => {
206+
master_run_body(is_regression)
207+
}
196208
};
197209
writeln!(&mut message, "{next_steps}\n").unwrap();
198210

@@ -404,16 +416,3 @@ Benchmarking means the PR may be perf-sensitive. \
404416
@rustbot label: -S-waiting-on-perf {sign}perf-regression",
405417
)
406418
}
407-
408-
fn triage_run_body(build: &TriageBuild, is_regression: bool) -> String {
409-
// The triage url deliberately not prefixed with "https://github.com/" as to not trigger the
410-
// "mentioned this pull request" github entry on the rollup
411-
format!(
412-
"This PR was benchmarked as part of triage of its containing rollup: [triage URL](/rust-lang/rust/pull/{}#issuecomment-{}).\
413-
\n\n\
414-
{}",
415-
build.rollup_pr_number,
416-
build.triage_comment.full_database_id,
417-
master_run_body(is_regression)
418-
)
419-
}

0 commit comments

Comments
 (0)