From cee021f065641bb29cd959f71c6017b445d34886 Mon Sep 17 00:00:00 2001 From: Vivian Date: Fri, 18 Oct 2024 13:32:21 +0200 Subject: [PATCH] Include repo name in merge commit --- src/bors/handlers/trybuild.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bors/handlers/trybuild.rs b/src/bors/handlers/trybuild.rs index 6fc0de4..c5d13e8 100644 --- a/src/bors/handlers/trybuild.rs +++ b/src/bors/handlers/trybuild.rs @@ -8,6 +8,7 @@ use crate::bors::Comment; use crate::bors::RepositoryState; use crate::database::RunId; use crate::database::{BuildModel, BuildStatus, PullRequestModel, WorkflowStatus, WorkflowType}; +use crate::github::GithubRepoName; use crate::github::{ CommitSha, GithubUser, LabelTrigger, MergeError, PullRequest, PullRequestNumber, }; @@ -93,7 +94,7 @@ pub(super) async fn command_try_build( .merge_branches( TRY_MERGE_BRANCH_NAME, &pr.head.sha, - &auto_merge_commit_message(pr, "", jobs), + &auto_merge_commit_message(pr, repo.client.repository(), "", jobs), ) .await { @@ -231,16 +232,23 @@ fn get_pending_build(pr: PullRequestModel) -> Option { .and_then(|b| (b.status == BuildStatus::Pending).then_some(b)) } -fn auto_merge_commit_message(pr: &PullRequest, reviewer: &str, jobs: Vec) -> String { +fn auto_merge_commit_message( + pr: &PullRequest, + name: &GithubRepoName, + reviewer: &str, + jobs: Vec, +) -> String { let pr_number = pr.number; let mut message = format!( - r#"Auto merge of #{pr_number} - {pr_label}, r={reviewer} + r#"Auto merge of {repo_owner}/{repo_name}#{pr_number} - {pr_label}, r={reviewer} {pr_title} {pr_message}"#, pr_label = pr.head_label, pr_title = pr.title, - pr_message = pr.message + pr_message = pr.message, + repo_owner = name.owner(), + repo_name = name.name() ); // if jobs is empty, try-job won't be added to the message