|
@@ -9,8 +9,6 @@ use interactions::ErrorComment;
|
|
|
use std::fmt;
|
|
|
use tracing as log;
|
|
|
|
|
|
-use crate::github::PullRequestDetails;
|
|
|
-
|
|
|
pub mod actions;
|
|
|
pub mod agenda;
|
|
|
mod changelogs;
|
|
@@ -108,12 +106,7 @@ pub async fn webhook(
|
|
|
.map_err(anyhow::Error::from)?;
|
|
|
|
|
|
log::info!("handling pull request review comment {:?}", payload);
|
|
|
-
|
|
|
- // Github doesn't send a pull_request field nested into the
|
|
|
- // pull_request field, so we need to adjust the deserialized result
|
|
|
- // to preserve that this event came from a pull request (since it's
|
|
|
- // a PR review, that's obviously the case).
|
|
|
- payload.pull_request.pull_request = Some(PullRequestDetails {});
|
|
|
+ payload.pull_request.pull_request = true;
|
|
|
|
|
|
// Treat pull request review comments exactly like pull request
|
|
|
// review comments.
|
|
@@ -138,11 +131,7 @@ pub async fn webhook(
|
|
|
.context("PullRequestReview(Comment) failed to deserialize")
|
|
|
.map_err(anyhow::Error::from)?;
|
|
|
|
|
|
- // Github doesn't send a pull_request field nested into the
|
|
|
- // pull_request field, so we need to adjust the deserialized result
|
|
|
- // to preserve that this event came from a pull request (since it's
|
|
|
- // a PR review, that's obviously the case).
|
|
|
- payload.issue.pull_request = Some(PullRequestDetails {});
|
|
|
+ payload.issue.pull_request = true;
|
|
|
|
|
|
log::info!("handling pull request review comment {:?}", payload);
|
|
|
|
|
@@ -166,10 +155,14 @@ pub async fn webhook(
|
|
|
github::Event::IssueComment(payload)
|
|
|
}
|
|
|
EventName::Issue | EventName::PullRequest => {
|
|
|
- let payload = deserialize_payload::<github::IssuesEvent>(&payload)
|
|
|
+ let mut payload = deserialize_payload::<github::IssuesEvent>(&payload)
|
|
|
.context(format!("{:?} failed to deserialize", event))
|
|
|
.map_err(anyhow::Error::from)?;
|
|
|
|
|
|
+ if matches!(event, EventName::PullRequest) {
|
|
|
+ payload.issue.pull_request = true;
|
|
|
+ }
|
|
|
+
|
|
|
log::info!("handling issue event {:?}", payload);
|
|
|
|
|
|
github::Event::Issue(payload)
|