8000 feat: allow `publish` plugins to return `false` in order to signify n… · semantic-release/semantic-release@70c68ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 70c68ef

Browse files
committed
feat: allow publish plugins to return false in order to signify no release was done
1 parent 048292b commit 70c68ef

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/definitions/plugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = {
7373
transform: (release, step, {nextRelease}) => ({
7474
...(isPlainObject(release) ? release : {}),
7575
...nextRelease,
76-
...step,
76+
...(release === false ? {} : step),
7777
}),
7878
}),
7979
},

test/definitions/plugins.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ test('The "generateNotes" plugin output, if defined, must be a string', t => {
2222
t.true(plugins.generateNotes.outputValidator('string'));
2323
});
2424

25-
test('The "publish" plugin output, if defined, must be an object', t => {
25+
test('The "publish" plugin output, if defined, must be an object or "false"', t => {
2626
t.false(plugins.publish.outputValidator(1));
2727
t.false(plugins.publish.outputValidator('string'));
2828

2929
t.true(plugins.publish.outputValidator({}));
3030
t.true(plugins.publish.outputValidator());
3131
t.true(plugins.publish.outputValidator(null));
3232
t.true(plugins.publish.outputValidator(''));
33+
t.true(plugins.publish.outputValidator(false));
3334
});
3435

3536
test('The "generateNotes" plugins output are concatenated with separator and sensitive data is hidden', t => {

test/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ test('Allow local releases with "noCi" option', async t => {
693693
t.is(success.callCount, 1);
694694
});
695695

696-
test('Accept "undefined" value returned by the "generateNotes" plugins', async t => {
696+
test('Accept "undefined" value returned by "generateNotes" and "false" by "publish"', async t => {
697697
// Create a git repository, set the current working directory at the root of the repo
698698
const {cwd, repositoryUrl} = await gitRepo(true);
699699
// Add commits to the master branch
@@ -711,7 +711,7 @@ test('Accept "undefined" value returned by the "generateNotes" plugins', async t
711711
const generateNotes1 = stub().resolves();
712712
const notes2 = 'Release notes 2';
713713
const generateNotes2 = stub().resolves(notes2);
714-
const publish = stub().resolves();
714+
const publish = stub().resolves(false);
715715

716716
const options = {
717717
branch: 'master',

0 commit comments

Comments
 (0)
0