forked from the-distro/ofborg
Don't trigger events on deleted comments
According to https://developer.github.com/v3/activity/events/types/#issuecommentevent we should just filter out delete actions. Closes #156
This commit is contained in:
parent
1783e3a0e4
commit
43dc12d984
|
@ -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