From 8b5078e67ebbbe9e8a5a952fa18646dfca6a2563 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Mon, 23 Sep 2024 12:47:06 +0200 Subject: [PATCH] Feature (release-tools): Allow defining a main branch when generating the changelog entries. --- .../lib/tasks/generatechangelogformonorepository.js | 6 +++++- .../lib/tasks/generatechangelogforsinglepackage.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogformonorepository.js b/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogformonorepository.js index aba420bba..2d7606b54 100644 --- a/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogformonorepository.js +++ b/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogformonorepository.js @@ -53,6 +53,8 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c * * @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages. * + * @param {String} [options.mainBranch='master'] A name of the main branch in the repository. + * * @param {Array.} [options.externalRepositories=[]] An array of object with additional repositories * that the function takes into consideration while gathering commits. It assumes that those directories are also mono repositories. * @@ -85,6 +87,7 @@ export default async function generateChangelogForMonoRepository( options ) { cwd: options.cwd, from: options.from ? options.from : 'v' + rootPkgJson.version, releaseBranch: options.releaseBranch || 'master', + mainBranch: options.mainBranch || 'master', externalRepositories: options.externalRepositories || [] }; @@ -225,7 +228,8 @@ export default async function generateChangelogForMonoRepository( options ) { const commitOptions = { from: options.from, - releaseBranch: options.releaseBranch + releaseBranch: options.releaseBranch, + mainBranch: options.mainBranch }; let promise = getCommits( transformCommit, commitOptions ) diff --git a/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogforsinglepackage.js b/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogforsinglepackage.js index ab18ddba5..8d4dfc86a 100644 --- a/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogforsinglepackage.js +++ b/packages/ckeditor5-dev-release-tools/lib/tasks/generatechangelogforsinglepackage.js @@ -36,6 +36,8 @@ const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.'; * * @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages. * + * @param {String} [options.mainBranch='master'] A name of the main branch in the repository. + * * @param {FormatDateCallback} [options.formatDate] A callback allowing defining a custom format of the date inserted into the changelog. * If not specified, the default date matches the `YYYY-MM-DD` pattern. * @@ -53,7 +55,8 @@ export default async function generateChangelogForSinglePackage( options = {} ) const commitOptions = { from: options.from ? options.from : 'v' + pkgJson.version, - releaseBranch: options.releaseBranch + releaseBranch: options.releaseBranch || 'master', + mainBranch: options.mainBranch || 'master' }; // Initial release.