Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/handlers/check_commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use anyhow::Context as _;
use anyhow::bail;

use super::Context;
use crate::interactions::ErrorComment;
use crate::{
config::Config,
db::issue_data::IssueData,
Expand Down Expand Up @@ -157,7 +158,8 @@ async fn handle_new_state(
}

for error_to_add in errors_to_add {
let comment = event.issue.post_comment(&ctx.github, &error_to_add).await?;
let error_comment = ErrorComment::new(&event.issue, &error_to_add);
let comment = error_comment.post(&ctx.github).await?;
state.data.last_errors.push((error_to_add, comment.node_id));
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/interactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use tokio_postgres::Client as DbClient;

use crate::{
db::issue_data::IssueData,
github::{GithubClient, Issue},
github::{Comment, GithubClient, Issue},
};
use std::fmt::Write;

Expand All @@ -24,7 +24,7 @@ impl<'a> ErrorComment<'a> {
}
}

pub async fn post(&self, client: &GithubClient) -> anyhow::Result<()> {
pub async fn post(&self, client: &GithubClient) -> anyhow::Result<Comment> {
let mut body = String::new();
writeln!(body, "**Error**: {}", self.message)?;
writeln!(body)?;
Expand All @@ -33,8 +33,7 @@ impl<'a> ErrorComment<'a> {
"Please file an issue on GitHub at [triagebot](https://github.com/rust-lang/triagebot) if there's \
a problem with this bot, or reach out on [#t-infra](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra) on Zulip."
)?;
self.issue.post_comment(client, &body).await?;
Ok(())
self.issue.post_comment(client, &body).await
}
}

Expand Down
Loading