Skip to content

Commit 43ac762

Browse files
committed
feat: Better pull request messages
1 parent ae40e9a commit 43ac762

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Git/Project.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ public string ParseRef(string reference)
4141
throw new ApplicationException("Unable to find ref");
4242
}
4343

44+
public string GetAbbreviatedCommit(string reference)
45+
{
46+
foreach (var line in GetCommandOutput($"log --format=%h -1 {reference}"))
47+
{
48+
return line;
49+
}
50+
throw new ApplicationException("Unable to find ref");
51+
}
52+
4453
public string Describe(string options)
4554
{
4655
foreach (var line in GetCommandOutput($"describe {options}"))

Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ static async Task AsyncMain(IConfigurationRoot config)
134134
var newMergeBranchMessage = String.Format(gitHubConfig["mergeMessageFormat"],
135135
baseBranchVersion,
136136
autoMergePullRequestsSuccess.Count,
137-
String.Join("", autoMergePullRequestsSuccess.Select(pr => String.Format(gitHubConfig["mergeMessagePRFormat"], pr.Number, pr.Title)))
137+
String.Join("", autoMergePullRequestsSuccess.Select(pr => String.Format(
138+
gitHubConfig["mergeMessagePRFormat"],
139+
pr.Number,
140+
pr.Title,
141+
git.GetAbbreviatedCommit($"pull/{pr.Number}/head")
142+
)))
138143
);
139144
var newMergeBranchCommit = git.CommitTree($"{autoMergeCommit}^{{tree}}", mergeBranchParents, newMergeBranchMessage);
140145
git.SetBranchRef(gitHubConfig["mergeBranch"], newMergeBranchCommit);

0 commit comments

Comments
 (0)