prepare: {
required: false,
dryRun: false,
pipelineConfig: ({generateNotes}) => ({
getNextInput: async (context) => {
const newGitHead = await getGitHead({cwd: context.cwd});
// If previous prepare plugin has created a commit (gitHead changed)
if (context.nextRelease.gitHead !== newGitHead) {
context.nextRelease.gitHead = newGitHead;
// Regenerate the release notes
context.nextRelease.notes = await generateNotes(context);
}
// Call the next prepare plugin with the updated `nextRelease`
return context;
},
}),
},
The root cause of the bug is in this line context.nextRelease.notes = await generateNotes(context); that when we have multiple releases commit the gitHead will changed so the prepare state will try to generateNotes again with the context of prepare step.
But the inline plugin of multiple-semantic-release implements prepare function like this.
const prepare = async (pluginOptions, context) => {
// Wait until the current pkg is ready to be tagged
getLucky("_readyForTagging", pkg);
await waitFor("_readyForTagging", pkg);
updateManifestDeps(pkg);
pkg._depsUpdated = true;
const res = await plugins.prepare(context);
pkg._prepared = true;
debug(debugPrefix, "prepared");
return res;
};
Without
// Set context.commits so analyzeCommits does correct analysis.
// We need to redo this because context is a different instance each time.
context.commits = commits;
in prepare function, So the context.commits is all changes not only the filtered commits of each workspace.
I will open the PR for fix this by set the context.commits = commits in the prepare function too.
In the
semantic-release
the default behaviour of prepare step have the logic like this.https://github.com/semantic-release/semantic-release/blob/4c7222d6484983abd3c066e5de41e5ba8ac21c43/lib/definitions/plugins.js#L52,L69
The root cause of the bug is in this line
context.nextRelease.notes = await generateNotes(context);
that when we have multiple releases commit thegitHead
will changed so the prepare state will try to generateNotes again with the context of prepare step.But the inline plugin of
multiple-semantic-release
implementsprepare
function like this.https://github.com/qiwi/multi-semantic-release/blob/5ce8eca70f2ed1360654343b00e2125c3b1b7a6f/lib/createInlinePluginCreator.js#L183,L197
Without
in prepare function, So the
context.commits
is all changes not only the filtered commits of each workspace.I will open the PR for fix this by set the
context.commits = commits
in theprepare
function too.