1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-05-07 14:09:30 +02:00

Fix csv-parse implementation since major update

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-04-25 06:47:48 +02:00
parent 300b1bdff7
commit 5ea21bf2ba
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 22 additions and 16 deletions

View file

@ -1,4 +1,4 @@
import csvparse from 'csv-parse/lib/sync';
import {parse} from 'csv-parse/sync';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
@ -217,20 +217,22 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
return res;
}
for (const output of (await csvparse(items, {
const records = await parse(items, {
columns: false,
relax: true,
relaxQuotes: true,
relaxColumnCount: true,
skipLinesWithEmptyValues: true
})) as Array<string[]>) {
if (output.length == 1) {
res.push(output[0]);
skipEmptyLines: true
});
for (const record of records as Array<string[]>) {
if (record.length == 1) {
res.push(record[0]);
continue;
} else if (!ignoreComma) {
res.push(...output);
res.push(...record);
continue;
}
res.push(output.join(','));
res.push(record.join(','));
}
return res.filter(item => item).map(pat => pat.trim());