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
13 changes: 8 additions & 5 deletions src/bors/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +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 append_workflow_links_to_comment(comment_content: &mut String, workflow_urls: Vec<String>) {
if workflow_urls.len() == 1 {
comment_content.push_str(&format!("\n**Workflow**: {}", workflow_urls[0]));
} else {
comment_content.push_str("\n**Workflows**:\n\n");
for url in workflow_urls {
comment_content.push_str(&format!("- {url}\n"));
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/bors/handlers/trybuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,9 +1104,7 @@ try_failed = ["+foo", "+bar", "-baz"]

To cancel the try build, run the command `@bors try cancel`.

**Workflows**:

- https://github.com/rust-lang/borstest/actions/runs/1
**Workflow**: https://github.com/rust-lang/borstest/actions/runs/1
");

Ok(())
Expand Down
18 changes: 10 additions & 8 deletions src/bors/handlers/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@ async fn add_workflow_links_to_try_build_start_comment(

let workflows = db.get_workflow_urls_for_build(build).await?;

let mut comment_content = repo
.client
.get_comment_content(&try_build_comment.node_id)
.await?;
if !workflows.is_empty() {
let mut comment_content = repo
.client
.get_comment_content(&try_build_comment.node_id)
.await?;

append_workflow_links_to_comment(&mut comment_content, workflows);
append_workflow_links_to_comment(&mut comment_content, workflows);

repo.client
.update_comment_content(&try_build_comment.node_id, &comment_content)
.await?;
repo.client
.update_comment_content(&try_build_comment.node_id, &comment_content)
.await?;
}

Ok(())
}
Expand Down