Skip to content

Commit 181b7a3

Browse files
committed
Only add waiting on author label if the reviewer requested changes
1 parent c0b0eeb commit 181b7a3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/github.rs

+12
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ pub struct Comment {
292292
pub user: User,
293293
#[serde(alias = "submitted_at")] // for pull request reviews
294294
pub updated_at: chrono::DateTime<Utc>,
295+
#[serde(rename = "state")]
296+
pub pr_review_state: PullRequestReviewState,
297+
}
298+
299+
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
300+
#[derive(Debug, serde::Deserialize)]
301+
pub enum PullRequestReviewState {
302+
Approved,
303+
ChangesRequested,
304+
Commented,
305+
Dismissed,
306+
Pending,
295307
}
296308

297309
fn opt_string<'de, D>(deserializer: D) -> Result<String, D::Error>

src/handlers/review_submitted.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::github::{Issue, IssueCommentAction, IssueCommentEvent, Label};
1+
use crate::github::{Issue, IssueCommentAction, IssueCommentEvent, Label, Comment, PullRequestReviewState};
22
use crate::{config::ReviewSubmittedConfig, github::Event, handlers::Context};
33

44
pub(crate) async fn handle(
@@ -19,6 +19,10 @@ pub(crate) async fn handle(
1919
},
2020
) = event
2121
{
22+
if event.comment.pr_review_state != PullRequestReviewState::ChangesRequested {
23+
return Ok(());
24+
}
25+
2226
if event.issue.assignees.contains(&event.comment.user) {
2327
let labels = event
2428
.issue

0 commit comments

Comments
 (0)