From df3bb4014da7fdcc02c6ceab87933ba642701ef1 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 12 Oct 2021 01:42:32 +0300 Subject: [PATCH] Update create-matrix.js --- scripts/create-matrix.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) 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) })