diff --git a/src/config.rs b/src/config.rs index 244c35ef..e1ecce2d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,6 +15,10 @@ lazy_static::lazy_static! { RwLock::new(HashMap::new()); } +// This struct maps each possible option of the triagebot.toml. +// See documentation of options at: https://forge.rust-lang.org/triagebot/pr-assignment.html#configuration +// When adding a new config option to the triagebot.toml, it must be also mapped here +// Will be used by the `issue_handlers!()` or `command_handlers!()` macros. #[derive(PartialEq, Eq, Debug, serde::Deserialize)] #[serde(rename_all = "kebab-case")] #[serde(deny_unknown_fields)] @@ -39,6 +43,7 @@ pub(crate) struct Config { // We want this validation to run even without the entry in the config file #[serde(default = "ValidateConfig::default")] pub(crate) validate_config: Option, + pub(crate) pr_tracking: Option, } #[derive(PartialEq, Eq, Debug, serde::Deserialize)] @@ -317,6 +322,12 @@ pub(crate) struct GitHubReleasesConfig { pub(crate) changelog_branch: String, } +#[derive(PartialEq, Eq, Debug, serde::Deserialize)] +pub(crate) struct ReviewPrefsConfig { + #[serde(default)] + _empty: (), +} + fn get_cached_config(repo: &str) -> Option, ConfigurationError>> { let cache = CONFIG_CACHE.read().unwrap(); cache.get(repo).and_then(|(config, fetch_time)| { @@ -463,6 +474,7 @@ mod tests { mentions: None, no_merges: None, validate_config: Some(ValidateConfig {}), + pr_tracking: None, } ); } diff --git a/src/db.rs b/src/db.rs index 6d5b5e8c..1da96372 100644 --- a/src/db.rs +++ b/src/db.rs @@ -332,6 +332,7 @@ CREATE table review_prefs ( assigned_prs INT[] NOT NULL DEFAULT array[]::INT[] );", " +CREATE EXTENSION intarray; CREATE UNIQUE INDEX review_prefs_user_id ON review_prefs(user_id); ", ]; diff --git a/src/github.rs b/src/github.rs index 3b8d7ae8..c078fe56 100644 --- a/src/github.rs +++ b/src/github.rs @@ -286,8 +286,11 @@ pub struct Issue { /// /// Example: `https://github.com/octocat/Hello-World/pull/1347` pub html_url: String, + // User performing an `action` pub user: User, pub labels: Vec