refactor: use the lastInput
arg to compute the prepare
pipeline next input
Use the `getNextInput`'s provided argument rather than relying on the closure.
This commit is contained in:
parent
12de6282dd
commit
f7f4aabe9e
8
index.js
8
index.js
@ -114,17 +114,17 @@ async function run(options, plugins) {
|
|||||||
await plugins.prepare(
|
await plugins.prepare(
|
||||||
{options, logger, lastRelease, commits, nextRelease},
|
{options, logger, lastRelease, commits, nextRelease},
|
||||||
{
|
{
|
||||||
getNextInput: async lastResult => {
|
getNextInput: async ({nextRelease, ...prepareParam}) => {
|
||||||
const newGitHead = await getGitHead();
|
const newGitHead = await getGitHead();
|
||||||
// If previous prepare plugin has created a commit (gitHead changed)
|
// If previous prepare plugin has created a commit (gitHead changed)
|
||||||
if (lastResult.nextRelease.gitHead !== newGitHead) {
|
if (nextRelease.gitHead !== newGitHead) {
|
||||||
nextRelease.gitHead = newGitHead;
|
nextRelease.gitHead = newGitHead;
|
||||||
// Regenerate the release notes
|
// Regenerate the release notes
|
||||||
logger.log('Call plugin %s', 'generateNotes');
|
logger.log('Call plugin %s', 'generateNotes');
|
||||||
[nextRelease.notes] = await plugins.generateNotes(generateNotesParam);
|
[nextRelease.notes] = await plugins.generateNotes({nextRelease, ...prepareParam});
|
||||||
}
|
}
|
||||||
// Call the next publish plugin with the updated `nextRelease`
|
// Call the next publish plugin with the updated `nextRelease`
|
||||||
return {options, logger, lastRelease, commits, nextRelease};
|
return {...prepareParam, nextRelease};
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user