fix: simplify get-tags
algorithm
This commit is contained in:
parent
131734873e
commit
00420a83c0
@ -14,15 +14,10 @@ module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||
return pReduce(
|
||||
branches,
|
||||
async (branches, branch) => {
|
||||
const branchTags = await Promise.all(
|
||||
(await getTags(branch.name, {cwd, env}))
|
||||
.map(tag => {
|
||||
const [, version, channel] = tag.match(tagRegexp) || [];
|
||||
return {gitTag: tag, version, channel};
|
||||
})
|
||||
.filter(({version}) => version && semver.valid(semver.clean(version)))
|
||||
.map(async ({gitTag, ...rest}) => ({gitTag, ...rest}))
|
||||
);
|
||||
const branchTags = (await getTags(branch.name, {cwd, env})).reduce((tags, tag) => {
|
||||
const [, version, channel] = tag.match(tagRegexp) || [];
|
||||
return version && semver.valid(semver.clean(version)) ? [...tags, {gitTag: tag, version, channel}] : tags;
|
||||
}, []);
|
||||
|
||||
debug('found tags for branch %s: %o', branch.name, branchTags);
|
||||
return [...branches, {...branch, tags: branchTags}];
|
||||
|
Loading…
x
Reference in New Issue
Block a user