Skip to content

Commit 5b29b42

Browse files
Make comment of triage build link back to the triage invocation
1 parent c418de9 commit 5b29b42

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

site/src/github/comparison_summary.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ async fn summarize_run(
163163
)
164164
.unwrap();
165165

166-
let next_steps = match source {
166+
let next_steps = match &source {
167167
PerfRunSource::TryBuild => try_run_body(is_regression, deserves_attention),
168168
PerfRunSource::MasterCommit => master_run_body(is_regression),
169-
PerfRunSource::TriageBuild(_) => todo!(),
169+
PerfRunSource::TriageBuild(triage_build) => triage_run_body(triage_build, is_regression),
170170
};
171171
writeln!(&mut message, "{next_steps}\n").unwrap();
172172

@@ -372,3 +372,16 @@ Benchmarking means the PR may be perf-sensitive. \
372372
@rustbot label: -S-waiting-on-perf {sign}perf-regression",
373373
)
374374
}
375+
376+
fn triage_run_body(build: &TriageBuild, is_regression: bool) -> String {
377+
// The triage url deliberately not prefixed with "https://github.com/" as to not trigger the
378+
// "mentioned this pull request" github entry on the rollup
379+
format!(
380+
"This PR was benchmarked as part of triage on the rollup it merged in: [triage URL](/rust-lang/rust/pull/{}#issuecomment-{})\
381+
\n\n\
382+
{}",
383+
build.rollup_pr_number,
384+
build.triage_comment.id,
385+
master_run_body(is_regression)
386+
)
387+
}

site/src/github/triage.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use crate::request_handlers::parse_unrolled_build_message;
33
use database::QueuedCommit;
44

55
pub struct TriageBuild {
6-
rollup_pr_number: u32,
7-
triage_comment: ResponseComment,
6+
pub rollup_pr_number: u32,
7+
pub triage_comment: ResponseComment,
88
}
99

1010
pub const TRIAGE_MARKER: &str = "<!-- rust-timer: triage -->";
@@ -27,9 +27,7 @@ pub async fn is_triage_run(
2727
.get_comments(unrolled_build.rollup_pr_number)
2828
.await?;
2929
let Some(triage_comment) = rollup_comments.into_iter().rev().find(|c| {
30-
c.author.login == "rust-timer"
31-
&& c.body.contains(TRIAGE_MARKER)
32-
&& c.body.contains(&commit.sha)
30+
c.viewer_did_author && c.body.contains(TRIAGE_MARKER) && c.body.contains(&commit.sha)
3331
}) else {
3432
// This was a try job on the unrolled build that did not originate from a triage command
3533
return Ok(None);

0 commit comments

Comments
 (0)