diff --git a/src/config.rs b/src/config.rs index 38e81fce..2235c1ad 100644 --- a/src/config.rs +++ b/src/config.rs @@ -30,6 +30,7 @@ pub(crate) struct Config { pub(crate) notify_zulip: Option, pub(crate) github_releases: Option, pub(crate) review_submitted: Option, + pub(crate) review_requested: Option, pub(crate) shortcut: Option, pub(crate) note: Option, pub(crate) mentions: Option, @@ -253,6 +254,12 @@ pub(crate) struct ReviewSubmittedConfig { pub(crate) reviewed_label: String, } +#[derive(PartialEq, Eq, Debug, serde::Deserialize)] +pub(crate) struct ReviewRequestedConfig { + pub(crate) remove_labels: Vec, + pub(crate) add_labels: Vec, +} + pub(crate) async fn get( gh: &GithubClient, repo: &Repository, @@ -421,6 +428,7 @@ mod tests { notify_zulip: None, github_releases: None, review_submitted: None, + review_requested: None, mentions: None, no_merges: None, } diff --git a/src/github.rs b/src/github.rs index 59fb6326..310d71c3 100644 --- a/src/github.rs +++ b/src/github.rs @@ -923,7 +923,7 @@ pub struct IssueCommentEvent { } #[derive(PartialEq, Eq, Debug, serde::Deserialize)] -#[serde(rename_all = "snake_case")] +#[serde(rename_all = "snake_case", tag = "action")] pub enum IssuesAction { Opened, Edited, @@ -935,13 +935,22 @@ pub enum IssuesAction { Reopened, Assigned, Unassigned, - Labeled, - Unlabeled, + Labeled { + /// The label added from the issue + label: Label, + }, + Unlabeled { + /// The label removed from the issue + label: Label, + }, Locked, Unlocked, Milestoned, Demilestoned, - ReviewRequested, + ReviewRequested { + /// The person requested to review the pull request + requested_reviewer: User, + }, ReviewRequestRemoved, ReadyForReview, Synchronize, @@ -952,13 +961,14 @@ pub enum IssuesAction { #[derive(Debug, serde::Deserialize)] pub struct IssuesEvent { + #[serde(flatten)] pub action: IssuesAction, #[serde(alias = "pull_request")] pub issue: Issue, pub changes: Option, pub repository: Repository, - /// Some if action is IssuesAction::Labeled, for example - pub label: Option