Skip to content

Commit

Permalink
Merge pull request #166 from NULLx76/include_repo_name
Browse files Browse the repository at this point in the history
Include repo name in merge commit
  • Loading branch information
Kobzol authored Oct 18, 2024
2 parents 2deb846 + cee021f commit 2430e3c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/bors/handlers/trybuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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, "<try>", jobs),
&auto_merge_commit_message(pr, repo.client.repository(), "<try>", jobs),
)
.await
{
Expand Down Expand Up @@ -231,16 +232,23 @@ fn get_pending_build(pr: PullRequestModel) -> Option<BuildModel> {
.and_then(|b| (b.status == BuildStatus::Pending).then_some(b))
}

fn auto_merge_commit_message(pr: &PullRequest, reviewer: &str, jobs: Vec<String>) -> String {
fn auto_merge_commit_message(
pr: &PullRequest,
name: &GithubRepoName,
reviewer: &str,
jobs: Vec<String>,
) -> 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
Expand Down

0 comments on commit 2430e3c

Please sign in to comment.