Update create-matrix.js

This commit is contained in:
Aleksandr Statciuk 2021-10-12 01:42:32 +03:00
parent d15e2abbe4
commit df3bb4014d

View file

@ -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)}` const output = `::set-output name=matrix::${JSON.stringify(matrix)}`
console.log(output) console.log(output)
}) })