Skip to content

Commit 04422ac

Browse files
authored
When merging and there's a single commit on a branch, the second line from the commit message is merged to one line (#5774)
Fixes #5756
1 parent 850a965 commit 04422ac

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/github/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ function parseCommitMeta(titleSource: GraphQL.DefaultCommitTitle | undefined, de
737737
}
738738
case GraphQL.DefaultCommitTitle.commitOrPrTitle: {
739739
if (pullRequest.commits.length === 1) {
740-
title = `${pullRequest.commits[0].message} ${prNumberPostfix}`;
740+
title = `${pullRequest.commits[0].message.split('\n')[0]} ${prNumberPostfix}`;
741741
} else {
742742
title = `${pullRequest.title} ${prNumberPostfix}`;
743743
}
@@ -750,7 +750,12 @@ function parseCommitMeta(titleSource: GraphQL.DefaultCommitTitle | undefined, de
750750
break;
751751
}
752752
case GraphQL.DefaultCommitMessage.commitMessages: {
753-
description = pullRequest.commits.map(commit => `* ${commit.message}`).join('\n\n');
753+
if ((pullRequest.commits.length === 1) && (titleSource === GraphQL.DefaultCommitTitle.commitOrPrTitle)) {
754+
const split = pullRequest.commits[0].message.split('\n');
755+
description = split.length > 1 ? split.slice(1).join('\n') : '';
756+
} else {
757+
description = pullRequest.commits.map(commit => `* ${commit.message}`).join('\n\n');
758+
}
754759
break;
755760
}
756761
case GraphQL.DefaultCommitMessage.prTitle: {

0 commit comments

Comments
 (0)