fix: remove confusing logs when searching for releases to add to a channel
This commit is contained in:
parent
9a04e64fab
commit
162b4b9e3b
10
index.js
10
index.js
@ -127,6 +127,16 @@ async function run(context, plugins) {
|
|||||||
|
|
||||||
context.lastRelease = await getLastRelease(context);
|
context.lastRelease = await getLastRelease(context);
|
||||||
|
|
||||||
|
if (context.lastRelease.gitTag) {
|
||||||
|
logger.log(
|
||||||
|
`Found git tag ${context.lastRelease.gitTag} associated with version ${context.lastRelease.version} on branch ${
|
||||||
|
context.branch.name
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.log(`No git tag version found on branch ${context.branch.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
context.commits = await getCommits(context);
|
context.commits = await getCommits(context);
|
||||||
|
|
||||||
const nextRelease = {
|
const nextRelease = {
|
||||||
|
@ -23,17 +23,15 @@ const {makeTag} = require('./utils');
|
|||||||
*
|
*
|
||||||
* @return {LastRelease} The last tagged release or empty object if none is found.
|
* @return {LastRelease} The last tagged release or empty object if none is found.
|
||||||
*/
|
*/
|
||||||
module.exports = ({branch: {name, tags, type}, options: {tagFormat}, logger}, {before} = {}) => {
|
module.exports = ({branch: {tags, type}, options: {tagFormat}}, {before} = {}) => {
|
||||||
const [{version, gitTag, gitHead, channel} = {}] = tags
|
const [{version, gitTag, gitHead, channel} = {}] = tags
|
||||||
.filter(tag => type === 'prerelease' || !semver.prerelease(tag.version))
|
.filter(tag => type === 'prerelease' || !semver.prerelease(tag.version))
|
||||||
.filter(tag => isUndefined(before) || semver.lt(tag.version, before))
|
.filter(tag => isUndefined(before) || semver.lt(tag.version, before))
|
||||||
.sort((a, b) => semver.rcompare(a.version, b.version));
|
.sort((a, b) => semver.rcompare(a.version, b.version));
|
||||||
|
|
||||||
if (gitTag) {
|
if (gitTag) {
|
||||||
logger.log(`Found git tag ${gitTag} associated with version ${version} on branch ${name}`);
|
|
||||||
return {version, gitTag, gitHead, channel, name: makeTag(tagFormat, version)};
|
return {version, gitTag, gitHead, channel, name: makeTag(tagFormat, version)};
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.log(`No git tag version found on branch ${name}`);
|
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
import {stub} from 'sinon';
|
|
||||||
import getLastRelease from '../lib/get-last-release';
|
import getLastRelease from '../lib/get-last-release';
|
||||||
|
|
||||||
test.beforeEach(t => {
|
|
||||||
// Stub the logger functions
|
|
||||||
t.context.log = stub();
|
|
||||||
t.context.logger = {log: t.context.log};
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Get the highest non-prerelease valid tag', t => {
|
test('Get the highest non-prerelease valid tag', t => {
|
||||||
const result = getLastRelease({
|
const result = getLastRelease({
|
||||||
branch: {
|
branch: {
|
||||||
@ -20,11 +13,9 @@ test('Get the highest non-prerelease valid tag', t => {
|
|||||||
type: 'release',
|
type: 'release',
|
||||||
},
|
},
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, {version: '2.0.0', gitTag: 'v2.0.0', name: 'v2.0.0', gitHead: '222', channel: undefined});
|
t.deepEqual(result, {version: '2.0.0', gitTag: 'v2.0.0', name: 'v2.0.0', gitHead: '222', channel: undefined});
|
||||||
t.deepEqual(t.context.log.args[0][0], 'Found git tag v2.0.0 associated with version 2.0.0 on branch master');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Return empty object if no valid tag is found', t => {
|
test('Return empty object if no valid tag is found', t => {
|
||||||
@ -35,11 +26,9 @@ test('Return empty object if no valid tag is found', t => {
|
|||||||
type: 'release',
|
type: 'release',
|
||||||
},
|
},
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, {});
|
t.deepEqual(result, {});
|
||||||
t.deepEqual(t.context.log.args[0][0], 'No git tag version found on branch master');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Get the highest non-prerelease valid tag before a certain version', t => {
|
test('Get the highest non-prerelease valid tag before a certain version', t => {
|
||||||
@ -58,11 +47,9 @@ test('Get the highest non-prerelease valid tag before a certain version', t => {
|
|||||||
type: 'release',
|
type: 'release',
|
||||||
},
|
},
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
},
|
},
|
||||||
{before: '2.1.0'}
|
{before: '2.1.0'}
|
||||||
);
|
);
|
||||||
|
|
||||||
t.deepEqual(result, {version: '2.0.0', gitTag: 'v2.0.0', name: 'v2.0.0', gitHead: '333', channel: undefined});
|
t.deepEqual(result, {version: '2.0.0', gitTag: 'v2.0.0', name: 'v2.0.0', gitHead: '333', channel: undefined});
|
||||||
t.deepEqual(t.context.log.args[0][0], 'Found git tag v2.0.0 associated with version 2.0.0 on branch master');
|
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
import {stub} from 'sinon';
|
|
||||||
import getReleasesToAdd from '../lib/get-releases-to-add';
|
import getReleasesToAdd from '../lib/get-releases-to-add';
|
||||||
|
|
||||||
test.beforeEach(t => {
|
|
||||||
// Stub the logger functions
|
|
||||||
t.context.log = stub();
|
|
||||||
t.context.logger = {log: t.context.log};
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Return versions merged from release to maintenance branch', t => {
|
test('Return versions merged from release to maintenance branch', t => {
|
||||||
const result = getReleasesToAdd({
|
const result = getReleasesToAdd({
|
||||||
branch: {
|
branch: {
|
||||||
@ -22,7 +15,6 @@ test('Return versions merged from release to maintenance branch', t => {
|
|||||||
},
|
},
|
||||||
branches: [{name: '1.x', channel: '1.x'}, {name: 'master'}],
|
branches: [{name: '1.x', channel: '1.x'}, {name: 'master'}],
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
@ -80,7 +72,6 @@ test('Return versions merged from future branch to release branch', t => {
|
|||||||
},
|
},
|
||||||
branches: [{name: 'master'}, {name: 'next', channel: 'next'}, {name: 'next-major', channel: 'next-major'}],
|
branches: [{name: 'master'}, {name: 'next', channel: 'next'}, {name: 'next-major', channel: 'next-major'}],
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
@ -138,7 +129,6 @@ test('Return releases sorted by ascending order', t => {
|
|||||||
},
|
},
|
||||||
branches: [{name: 'master'}, {name: 'next', channel: 'next'}, {name: 'next-major', channel: 'next-major'}],
|
branches: [{name: 'master'}, {name: 'next', channel: 'next'}, {name: 'next-major', channel: 'next-major'}],
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
@ -188,7 +178,6 @@ test('no lastRelease', t => {
|
|||||||
branch: {name: 'master', tags: [{gitTag: 'v1.0.0@next', version: '1.0.0', channel: 'next', gitHead: '111'}]},
|
branch: {name: 'master', tags: [{gitTag: 'v1.0.0@next', version: '1.0.0', channel: 'next', gitHead: '111'}]},
|
||||||
branches: [{name: 'master'}, {name: 'next', channel: 'next'}],
|
branches: [{name: 'master'}, {name: 'next', channel: 'next'}],
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
@ -231,7 +220,6 @@ test('Ignore pre-release versions', t => {
|
|||||||
{name: 'alpha', type: 'prerelease', channel: 'alpha'},
|
{name: 'alpha', type: 'prerelease', channel: 'alpha'},
|
||||||
],
|
],
|
||||||
options: {tagFormat: `v\${version}`},
|
options: {tagFormat: `v\${version}`},
|
||||||
logger: t.context.logger,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user