mirror of
https://codeberg.org/icewind/attic-action.git
synced 2026-06-03 17:44:07 +02:00
saneSplit -> nonEmptySplit
This commit is contained in:
parent
cea7883cb2
commit
34a3c66a7e
5 changed files with 21 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import {extrasperse, saneSplit} from './strings';
|
||||
import {prependEach, nonEmptySplit} from './strings';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
|
|
@ -37,12 +37,12 @@ async function run() {
|
|||
},
|
||||
}
|
||||
};
|
||||
const args = extrasperse('-A', saneSplit(attributes, /\s/)).concat([file || "default.nix"]);
|
||||
const args = prependEach('-A', nonEmptySplit(attributes, /\s/)).concat([file || "default.nix"]);
|
||||
await exec.exec('nix-build', args, options);
|
||||
core.endGroup()
|
||||
|
||||
core.startGroup(`Cachix: pushing to ` + push);
|
||||
await exec.exec('cachix', ['push', push].concat(saneSplit(paths, /\s/).join(' ')));
|
||||
await exec.exec('cachix', ['push', push].concat(nonEmptySplit(paths, /\s/).join(' ')));
|
||||
core.endGroup()
|
||||
} catch (error) {
|
||||
core.setFailed(`Action failed with error: ${error}`);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
export function extrasperse (elem: string, array: string[]): string[] {
|
||||
const init: string[] = [];
|
||||
return array.reduce((r, a) => r.concat(elem, a), init)
|
||||
};
|
||||
export function prependEach (elem: string, array: string[]): string[] {
|
||||
const init: string[] = [];
|
||||
return array.reduce((r, a) => r.concat(elem, a), init)
|
||||
};
|
||||
|
||||
export function saneSplit (str: string, separator): string[] {
|
||||
export function nonEmptySplit (str: string, separator): string[] {
|
||||
return str.split(separator).filter(word => word != "")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue