diff --git a/scripts/create-matrix.js b/scripts/create-matrix.js index 31f693ec..54f27d99 100644 --- a/scripts/create-matrix.js +++ b/scripts/create-matrix.js @@ -1,9 +1,26 @@ -const file = require('./file.js') +const file = require('./file') +const parser = require('./parser') + +const days = 2 +const includes = [] + +file.list('sites/*.channels.xml', includes).then(files => { + const matrix = { + site: [], + country: [], + days: [] + } + + files.forEach(filename => { + const channelsFile = file.read(filename) + const parsed = parser.parseChannels(channelsFile) + parsed.groups.forEach(group => { + matrix.site.push(parsed.site) + matrix.country.push(group.country) + matrix.days.push(days) + }) + }) -file.list('channels/**/*.xml', ['ad'], ['us-local']).then(files => { - const country = files.map(file => file.replace(/channels\/|\.xml/gi, '')) - const days = country.map(() => 2) - const matrix = { country, days } const output = `::set-output name=matrix::${JSON.stringify(matrix)}` console.log(output) })