fix: semantic commit messages should always be lower case (#598)

commitMessage and prTitle will be converted to lowercase after compilation if semanticCommits=true

Fixes #594
pull/602/head v9.32.2
Rhys Arkins 2017-08-03 21:49:44 +02:00 committed by GitHub
parent 3df264501f
commit 6c1f27f905
3 changed files with 8 additions and 1 deletions

View File

@ -81,7 +81,10 @@ async function ensureBranch(config) {
// If undefined, this will mean the defaultBranch
const parentBranch = await module.exports.getParentBranch(branchName, config);
const commitMessage = handlebars.compile(config.commitMessage)(config);
let commitMessage = handlebars.compile(config.commitMessage)(config);
if (config.semanticCommits) {
commitMessage = commitMessage.toLowerCase();
}
const api = config.api;
const cacheFolder = config.yarnCacheFolder;
const packageFiles = {};

View File

@ -65,6 +65,9 @@ function generateConfig(branchUpgrades) {
logger.debug('Compiling branchName and prTitle');
upgrade.branchName = handlebars.compile(upgrade.branchName)(upgrade);
upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade);
if (upgrade.semanticCommits) {
upgrade.prTitle = upgrade.prTitle.toLowerCase();
}
logger.debug(`${upgrade.branchName}, ${upgrade.prTitle}`);
config.upgrades.push(upgrade);
}

View File

@ -140,6 +140,7 @@ describe('workers/branch', () => {
branchWorker.getParentBranch.mockReturnValueOnce('dummy branch');
packageJsonHelper.setNewValue.mockReturnValueOnce('new content');
config.api.branchExists.mockReturnValueOnce(true);
config.semanticCommits = true;
expect(await branchWorker.ensureBranch(config)).toBe(true);
expect(branchWorker.getParentBranch.mock.calls.length).toBe(1);
expect(packageJsonHelper.setNewValue.mock.calls.length).toBe(1);