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
18 changes: 15 additions & 3 deletions src/bors/approval_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ async fn process_tentative_approval(
repo.client
.post_comment(
pr.number,
tentative_approval_removed_comment(&gh_pr.head.sha),
tentative_approval_removed_comment(
repo.repository(),
&gh_pr,
&approval_info.sha,
),
&ctx.db,
)
.await?;
Expand Down Expand Up @@ -276,7 +280,11 @@ mod tests {

ctx.pr_workflow_failure(workflow).await?;

insta::assert_snapshot!(ctx.get_next_comment_text(()).await?, @":x: Commit pr-1-sha has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure.");
insta::assert_snapshot!(ctx.get_next_comment_text(()).await?, @"
:x: Commit pr-1-sha has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure.

[View changes since this unapproval](https://triagebot.infra.rust-lang.org/gh-changes-since/rust-lang/borstest/1/main-sha1..pr-1-sha)
");
ctx.pr(()).await.expect_unapproved();
Ok(())
})
Expand Down Expand Up @@ -311,7 +319,11 @@ mod tests {

ctx.refresh_tentative_approvals().await;

insta::assert_snapshot!(ctx.get_next_comment_text(()).await?, @":x: Commit pr-1-sha has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure.");
insta::assert_snapshot!(ctx.get_next_comment_text(()).await?, @"
:x: Commit pr-1-sha has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure.

[View changes since this unapproval](https://triagebot.infra.rust-lang.org/gh-changes-since/rust-lang/borstest/1/main-sha1..pr-1-sha)
");
ctx.pr(()).await.expect_unapproved();
Ok(())
})
Expand Down
17 changes: 14 additions & 3 deletions src/bors/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::bors::approval::ApprovalNote;
use crate::bors::command::CommandPrefix;
use crate::bors::{FailedWorkflowRun, WorkflowRun};
use crate::database::PullRequestModel;
use crate::github::{GithubRepoName, GithubUser, PullRequestNumber};
use crate::github::{GithubRepoName, GithubUser, PullRequest, PullRequestNumber};
use crate::utils::text::pluralize;
use crate::{TreeState, database::WorkflowStatus, github::CommitSha};
use itertools::Itertools;
Expand Down Expand Up @@ -380,9 +380,20 @@ Reason for tree closure: `{reason}`
Comment::new(comment)
}

pub fn tentative_approval_removed_comment(commit_sha: &CommitSha) -> Comment {
pub fn tentative_approval_removed_comment(
repo: &GithubRepoName,
pr: &PullRequest,
approved_sha: &str,
) -> Comment {
Comment::new(format!(
":x: Commit {commit_sha} has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure."
r#":x: Commit {approved_sha} has been unapproved due to PR CI failure. Reapprove it with `@bors r+ force` if you want to ignore the failure.

[View changes since this unapproval](https://triagebot.infra.rust-lang.org/gh-changes-since/{}/{}/{}/{}..{approved_sha})
"#,
repo.owner(),
repo.name(),
pr.number,
pr.base.sha
))
}

Expand Down
Loading