Skip to content

Commit 2c25fd1

Browse files
committed
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 #73
1 parent 6437927 commit 2c25fd1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/bin/server/worker.rs

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::str;
1010
use std::time::{Duration, Instant};
1111

1212
const MINIMUM_DELAY_BETWEEN_INDEX_BACKUPS: Duration = Duration::from_secs(60 * 60);
13+
const SILENCE_LABEL: &str = "rla-silenced";
1314

1415
pub struct Worker {
1516
debug_post: Option<(String, u32)>,
@@ -270,6 +271,14 @@ impl Worker {
270271
info!("Build results outdated, skipping report.");
271272
return Ok(());
272273
}
274+
if pr_info
275+
.labels
276+
.iter()
277+
.any(|label| label.name == SILENCE_LABEL)
278+
{
279+
info!("PR has label `{SILENCE_LABEL}`, skipping report");
280+
return Ok(());
281+
}
273282
}
274283

275284
let (repo, pr) = match self.debug_post {

src/github.rs

+6
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ pub struct CommitStatusEvent {
6161
#[derive(Deserialize)]
6262
pub struct Pr {
6363
pub head: PrCommitRef,
64+
pub labels: Vec<Label>,
6465
}
6566

6667
#[derive(Deserialize)]
6768
pub struct PrCommitRef {
6869
pub sha: String,
6970
}
7071

72+
#[derive(Deserialize)]
73+
pub struct Label {
74+
pub name: String,
75+
}
76+
7177
#[derive(Deserialize)]
7278
pub struct CommitMeta {
7379
pub commit: Commit,

0 commit comments

Comments
 (0)