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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/bors/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ pub fn try_build_started_comment(
Comment::new(msg)
}

pub fn append_workflow_links_to_comment(comment_content: &mut String, workflow_links: Vec<String>) {
comment_content.push_str("\n**Workflows**:\n\n");

for link in workflow_links {
comment_content.push_str(&format!("- {link}\n"));
}
}

pub fn merge_conflict_comment(branch: &str) -> Comment {
let message = format!(
r#":lock: Merge conflict
Expand Down
2 changes: 1 addition & 1 deletion src/bors/handlers/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod tests {
async fn help_command(pool: sqlx::PgPool) {
run_test(pool, async |tester: &mut BorsTester| {
tester.post_comment("@bors help").await?;
insta::assert_snapshot!(tester.get_comment_text(()).await?, @r"
insta::assert_snapshot!(tester.get_next_comment_text(()).await?, @r"
You can use the following commands:

## PR management
Expand Down
10 changes: 5 additions & 5 deletions src/bors/handlers/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mod tests {
run_test(pool, async |tester: &mut BorsTester| {
tester.post_comment("@bors info").await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
## Status of PR `1`
- Not Approved
Expand All @@ -113,7 +113,7 @@ mod tests {

tester.post_comment("@bors info").await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
## Status of PR `1`
- Approved by: `default-user`
Expand All @@ -134,7 +134,7 @@ mod tests {

tester.post_comment("@bors info").await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
## Status of PR `1`
- Not Approved
Expand All @@ -155,7 +155,7 @@ mod tests {

tester.post_comment("@bors info").await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
## Status of PR `1`
- Not Approved
Expand Down Expand Up @@ -186,7 +186,7 @@ mod tests {

tester.post_comment("@bors info").await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
## Status of PR `1`
- Approved by: `default-user`
Expand Down
4 changes: 2 additions & 2 deletions src/bors/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub async fn handle_bors_repository_event(
repo = payload.repository.to_string(),
id = payload.run_id.into_inner()
);
handle_workflow_started(db, payload)
handle_workflow_started(repo, db, payload)
.instrument(span.clone())
.await?;

Expand Down Expand Up @@ -721,7 +721,7 @@ mod tests {
async fn unknown_command(pool: sqlx::PgPool) {
run_test(pool, async |tester: &mut BorsTester| {
tester.post_comment(Comment::from("@bors foo")).await?;
insta::assert_snapshot!(tester.get_comment_text(()).await?, @r#"Unknown command "foo". Run `@bors help` to see available commands."#);
insta::assert_snapshot!(tester.get_next_comment_text(()).await?, @r#"Unknown command "foo". Run `@bors help` to see available commands."#);
Ok(())
})
.await;
Expand Down
2 changes: 1 addition & 1 deletion src/bors/handlers/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod tests {
async fn ping_command(pool: sqlx::PgPool) {
run_test(pool, async |tester: &mut BorsTester| {
tester.post_comment("@bors ping").await?;
assert_eq!(tester.get_comment_text(()).await?, "Pong 🏓!");
assert_eq!(tester.get_next_comment_text(()).await?, "Pong 🏓!");
Ok(())
})
.await;
Expand Down
8 changes: 4 additions & 4 deletions src/bors/handlers/pr_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ mod tests {
.await?;

insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
:warning: The base branch changed to `beta`, and the
PR will need to be re-approved.
Expand Down Expand Up @@ -368,7 +368,7 @@ mod tests {
tester.push_to_pr(()).await?;

insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@r"
:warning: A new commit `pr-1-commit-1` was pushed to the branch, the
PR will need to be re-approved.
Expand Down Expand Up @@ -681,7 +681,7 @@ mod tests {
.workflow_start(WorkflowRunData::from(tester.auto_branch().await).with_run_id(123))
.await?;
tester.push_to_pr(()).await?;
insta::assert_snapshot!(tester.get_comment_text(()).await?, @r"
insta::assert_snapshot!(tester.get_next_comment_text(()).await?, @r"
:warning: A new commit `pr-1-commit-1` was pushed to the branch, the
PR will need to be re-approved.

Expand Down Expand Up @@ -709,7 +709,7 @@ mod tests {

tester.workflow_start(tester.auto_branch().await).await?;
tester.push_to_pr(()).await?;
insta::assert_snapshot!(tester.get_comment_text(()).await?, @r"
insta::assert_snapshot!(tester.get_next_comment_text(()).await?, @r"
:warning: A new commit `pr-1-commit-1` was pushed to the branch, the
PR will need to be re-approved.

Expand Down
2 changes: 1 addition & 1 deletion src/bors/handlers/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ timeout = 3600
tester.cancel_timed_out_builds().await;
})
.await;
insta::assert_snapshot!(tester.get_comment_text(()).await?, @":boom: Test timed out after `3600`s");
insta::assert_snapshot!(tester.get_next_comment_text(()).await?, @":boom: Test timed out after `3600`s");
assert_eq!(
tester
.db()
Expand Down
6 changes: 3 additions & 3 deletions src/bors/handlers/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod tests {
.post_comment(Comment::from("@bors retry").with_author(User::unprivileged()))
.await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@"@unprivileged-user: :key: Insufficient privileges: not in review users"
);
Ok(())
Expand All @@ -68,7 +68,7 @@ mod tests {
run_test(pool, async |tester: &mut BorsTester| {
tester.post_comment(Comment::from("@bors retry")).await?;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@":exclamation: You can only retry pull requests that are approved and have a previously failed auto build"
);
Ok(())
Expand All @@ -89,7 +89,7 @@ mod tests {
tester.wait_for_pr((), |pr| pr.auto_build.is_none()).await?;
tester.process_merge_queue().await;
insta::assert_snapshot!(
tester.get_comment_text(()).await?,
tester.get_next_comment_text(()).await?,
@":hourglass: Testing commit pr-1-sha with merge merge-1-pr-1..."
);
Ok(())
Expand Down
Loading