Skip to content

Commit 47ae741

Browse files
committed
Gate FCP label addition on the POST_COMMENTS env var.
1 parent b765d8d commit 47ae741

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

src/github/nag.rs

+25-27
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ fn update_proposal_review_status(repo: &str, proposal_id: i32) -> DashResult<()>
7979
reviewed,
8080
l);
8181

82-
if reviewed {
83-
Some(username)
84-
} else {
85-
None
86-
}
82+
if reviewed { Some(username) } else { None }
8783
} else {
8884
None
8985
}
@@ -154,28 +150,32 @@ fn evaluate_nags() -> DashResult<()> {
154150

155151
// attempt to add the final-comment-period label
156152
// TODO only add label if FCP > 1 day
157-
let label_res = GH.add_label(&issue.repository, issue.number, "final-comment-period");
158-
159-
let added_label = match label_res {
160-
Ok(()) => true,
161-
Err(why) => {
162-
error!("Unable to add FCP label to {}#{}: {:?}",
163-
&issue.repository,
164-
issue.number,
165-
why);
166-
false
167-
}
168-
};
153+
use config::CONFIG;
154+
if CONFIG.post_comments {
155+
let label_res =
156+
GH.add_label(&issue.repository, issue.number, "final-comment-period");
157+
158+
let added_label = match label_res {
159+
Ok(()) => true,
160+
Err(why) => {
161+
error!("Unable to add FCP label to {}#{}: {:?}",
162+
&issue.repository,
163+
issue.number,
164+
why);
165+
false
166+
}
167+
};
169168

170-
let comment_type = CommentType::FcpAllReviewedNoConcerns {
171-
added_label: added_label,
172-
author: &initiator,
173-
status_comment_id: proposal.fk_bot_tracking_comment,
174-
};
169+
let comment_type = CommentType::FcpAllReviewedNoConcerns {
170+
added_label: added_label,
171+
author: &initiator,
172+
status_comment_id: proposal.fk_bot_tracking_comment,
173+
};
175174

176-
// leave a comment for FCP start
177-
let fcp_start_comment = RfcBotComment::new(&issue, comment_type);
178-
fcp_start_comment.post(None)?;
175+
// leave a comment for FCP start
176+
let fcp_start_comment = RfcBotComment::new(&issue, comment_type);
177+
fcp_start_comment.post(None)?;
178+
}
179179
}
180180
}
181181

@@ -747,8 +747,6 @@ impl<'a> RfcBotComment<'a> {
747747
fn post(&self, existing_comment: Option<i32>) -> DashResult<CommentFromJson> {
748748
use config::CONFIG;
749749

750-
// TODO don't do this if the issue is closed
751-
752750
if CONFIG.post_comments {
753751

754752
if self.issue.open {

0 commit comments

Comments
 (0)