Skip to content

Commit

Permalink
Allow silencing RLA by setting the label rla-silence
Browse files Browse the repository at this point in the history
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 #73
  • Loading branch information
tgross35 committed Aug 10, 2023
1 parent 6437927 commit 2c25fd1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bin/server/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>,
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ pub struct CommitStatusEvent {
#[derive(Deserialize)]
pub struct Pr {
pub head: PrCommitRef,
pub labels: Vec<Label>,
}

#[derive(Deserialize)]
pub struct PrCommitRef {
pub sha: String,
}

#[derive(Deserialize)]
pub struct Label {
pub name: String,
}

#[derive(Deserialize)]
pub struct CommitMeta {
pub commit: Commit,
Expand Down

0 comments on commit 2c25fd1

Please sign in to comment.