fix: fetch all release branches on CI

This commit is contained in:
Pierre Vanduynslager
2018-11-29 20:03:51 -05:00
parent e63e753cf0
commit b729183b4a
6 changed files with 64 additions and 28 deletions
+11 -6
View File
@@ -3,20 +3,25 @@ const AggregateError = require('aggregate-error');
const pEachSeries = require('p-each-series');
const DEFINITIONS = require('../definitions/branches');
const getError = require('../get-error');
const {verifyBranchName} = require('../git');
const {fetch, verifyBranchName} = require('../git');
const expand = require('./expand');
const getTags = require('./get-tags');
const normalize = require('./normalize');
module.exports = async context => {
const branches = await getTags(
const {cwd, env} = context;
const remoteBranches = await expand(
context,
await expand(
context,
context.options.branches.map(branch => (isString(branch) || isRegExp(branch) ? {name: branch} : branch))
)
context.options.branches.map(branch => (isString(branch) || isRegExp(branch) ? {name: branch} : branch))
);
await pEachSeries(remoteBranches, async ({name}) => {
await fetch(name, {cwd, env});
});
const branches = await getTags(context, remoteBranches);
const errors = [];
const branchesByType = Object.entries(DEFINITIONS).reduce(
(branchesByType, [type, {filter}]) => ({[type]: branches.filter(filter), ...branchesByType}),