Select Git revision
Rhys Arkins
authored and
GitHub
committed
This PR adds the capability to renovate more than one base branch at a time. For instance, a project may have their released `3.x` version on `master`, while an upcoming `4.x` is being prepared using branch `next`. `4.x` might have a quite different set of dependencies (e.g. some removed or some added) so it's not appropriate to only target `master` and keep rebasing, as it will get messy. Instead, it's necessary to target both `master` and `next` to keep both updated. Closes #1279
commit.js 1.26 KiB
const handlebars = require('handlebars');
module.exports = {
commitFilesToBranch,
};
async function commitFilesToBranch(config) {
const updatedFiles = config.updatedPackageFiles.concat(
config.updatedLockFiles
);
if (updatedFiles.length) {
logger.debug(`${updatedFiles.length} file(s) to commit`);
let commitMessage = handlebars.compile(config.commitMessage)(config);
if (config.semanticCommits) {
const splitMessage = commitMessage.split('\n');
splitMessage[0] = splitMessage[0].toLowerCase();
let semanticPrefix = config.semanticCommitType;
if (config.semanticCommitScope) {
semanticPrefix += `(${config.semanticCommitScope})`;
}
commitMessage = `${semanticPrefix}: ${splitMessage.join('\n')}`;
}
if (config.commitBody) {
commitMessage = `${commitMessage}\n\n${handlebars.compile(
config.commitBody
)(config)}`;
}
// API will know whether to create new branch or not
await platform.commitFilesToBranch(
config.branchName,
updatedFiles,
commitMessage,
config.parentBranch || config.baseBranch || undefined,
config.gitAuthor,
config.gitPrivateKey
);
} else {
logger.debug(`No files to commit`);
return false;
}
return true;
}