Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow silencing RLA by setting the label rla-silenced #75

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading