Skip to content
Snippets Groups Projects
Commit e5654fc8 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix: convert only first line of commit message to lowercase (#779)

Helps #777
parent 1957bba6
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,9 @@ async function commitFilesToBranch(config) {
logger.debug(`${updatedFiles.length} file(s) to commit`);
let commitMessage = handlebars.compile(config.commitMessage)(config);
if (config.semanticCommits) {
commitMessage = `${config.semanticPrefix} ${commitMessage.toLowerCase()}`;
const splitMessage = commitMessage.split('\n');
splitMessage[0] = splitMessage[0].toLowerCase();
commitMessage = `${config.semanticPrefix} ${splitMessage.join('\n')}`;
}
// API will know whether to create new branch or not
await config.api.commitFilesToBranch(
......
......@@ -41,5 +41,18 @@ describe('workers/branch/automerge', () => {
expect(config.api.commitFilesToBranch.mock.calls.length).toBe(1);
expect(config.api.commitFilesToBranch.mock.calls).toMatchSnapshot();
});
it('lowercases only the first line when applying semantic prefix', async () => {
config.updatedPackageFiles.push({
name: 'package.json',
contents: 'some contents',
});
config.commitMessage = 'Foo\n\nBar';
config.semanticCommits = true;
await commitFilesToBranch(config);
expect(config.api.commitFilesToBranch.mock.calls.length).toBe(1);
expect(config.api.commitFilesToBranch.mock.calls[0][2]).toEqual(
'some-prefix foo\n\nBar'
);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment