From 17faeb883039518355588045bbe26f7714b64ae8 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 10 Aug 2023 15:37:33 -0400 Subject: [PATCH] Allow silencing RLA by setting the label `rla-silence` If a test is not run by Bors and the label `rla-silence` is applied to a PR, do not post an update messsage. This will allow keeping RLA message noise out of PRs that are expected to have a lot of churn. Fixes /~https://github.com/rust-lang/rust-log-analyzer/issues/73 --- src/bin/server/worker.rs | 9 +++++++++ src/github.rs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/bin/server/worker.rs b/src/bin/server/worker.rs index 5a7fe35..97a7875 100644 --- a/src/bin/server/worker.rs +++ b/src/bin/server/worker.rs @@ -10,6 +10,7 @@ use std::str; use std::time::{Duration, Instant}; const MINIMUM_DELAY_BETWEEN_INDEX_BACKUPS: Duration = Duration::from_secs(60 * 60); +const SILENCE_LABEL: &str = "rla-silenced"; pub struct Worker { debug_post: Option<(String, u32)>, @@ -270,6 +271,14 @@ impl Worker { info!("Build results outdated, skipping report."); return Ok(()); } + if pr_info + .labels + .iter() + .any(|label| label.name == SILENCE_LABEL) + { + info!("PR has label `{SILENCE_LABEL}`, skipping report"); + return Ok(()); + } } let (repo, pr) = match self.debug_post { diff --git a/src/github.rs b/src/github.rs index c535acb..6549aca 100644 --- a/src/github.rs +++ b/src/github.rs @@ -61,6 +61,7 @@ pub struct CommitStatusEvent { #[derive(Deserialize)] pub struct Pr { pub head: PrCommitRef, + pub labels: Vec