forked from the-distro/ofborg
Merge pull request #214 from NixOS/bug-156-deleted-comments
Don't trigger events on deleted comments
This commit is contained in:
commit
17f9a17f6a
|
@ -2,7 +2,16 @@ use ofborg::ghevent::{Comment, Repository, Issue};
|
|||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct IssueComment {
|
||||
pub action: IssueCommentAction,
|
||||
pub comment: Comment,
|
||||
pub repository: Repository,
|
||||
pub issue: Issue,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
#[serde(rename_all="snake_case")]
|
||||
pub enum IssueCommentAction {
|
||||
Created,
|
||||
Edited,
|
||||
Deleted,
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@ mod common;
|
|||
mod issuecomment;
|
||||
mod pullrequestevent;
|
||||
|
||||
pub use self::issuecomment::IssueComment;
|
||||
pub use self::issuecomment::{IssueComment,IssueCommentAction};
|
||||
pub use self::pullrequestevent::{PullRequest, PullRequestEvent, PullRequestAction, PullRequestState};
|
||||
pub use self::common::{Issue, Repository, User, Comment};
|
||||
|
|
|
@ -50,6 +50,10 @@ impl worker::SimpleWorker for GitHubCommentWorker {
|
|||
}
|
||||
|
||||
fn consumer(&mut self, job: &ghevent::IssueComment) -> worker::Actions {
|
||||
if job.action == ghevent::IssueCommentAction::Deleted {
|
||||
return vec![worker::Action::Ack];
|
||||
}
|
||||
|
||||
let instructions = commentparser::parse(&job.comment.body);
|
||||
if instructions == None {
|
||||
return vec![worker::Action::Ack];
|
||||
|
|
Loading…
Reference in a new issue