Skip to content

Commit 01830e4

Browse files
committed
Post comment when failing to add team label in ping command
1 parent 8536956 commit 01830e4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/handlers/ping.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,24 @@ pub(super) async fn handle_command(
6565
}
6666
};
6767

68-
if let Some(label) = config.label.clone() {
69-
event
68+
if let Some(label) = &config.label {
69+
if let Err(err) = event
7070
.issue()
7171
.unwrap()
72-
.add_labels(&ctx.github, vec![github::Label { name: label }])
73-
.await?;
72+
.add_labels(
73+
&ctx.github,
74+
vec![github::Label {
75+
name: label.clone(),
76+
}],
77+
)
78+
.await
79+
{
80+
let cmnt = ErrorComment::new(
81+
&event.issue().unwrap(),
82+
format!("Error adding team label (`{}`): {:?}.", label, err),
83+
);
84+
cmnt.post(&ctx.github).await?;
85+
}
7486
}
7587

7688
let mut users = Vec::new();

0 commit comments

Comments
 (0)