fix: call getTagHead only when necessary
This commit is contained in:
@@ -2,7 +2,7 @@ const {template, escapeRegExp} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const pReduce = require('p-reduce');
|
||||
const debug = require('debug')('semantic-release:get-tags');
|
||||
const {getTags, getTagHead} = require('../../lib/git');
|
||||
const {getTags} = require('../../lib/git');
|
||||
|
||||
module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||
// Generate a regex to parse tags formatted with `tagFormat`
|
||||
@@ -21,7 +21,7 @@ module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||
return {gitTag: tag, version, channel};
|
||||
})
|
||||
.filter(({version}) => version && semver.valid(semver.clean(version)))
|
||||
.map(async ({gitTag, ...rest}) => ({gitTag, gitHead: await getTagHead(gitTag, {cwd, env}), ...rest}))
|
||||
.map(async ({gitTag, ...rest}) => ({gitTag, ...rest}))
|
||||
);
|
||||
|
||||
debug('found tags for branch %s: %o', branch.name, branchTags);
|
||||
|
||||
Reference in New Issue
Block a user