pantry/scripts/utils/gha.ts
Max Howell fe002f9b9f “superenv” (#185)
* fixes for dylib ids on darwin (sadly elaborate)

* wip
2022-10-17 13:45:32 -04:00

19 lines
456 B
TypeScript

const e = new TextEncoder()
const encode = e.encode.bind(e)
export function set_output<T>(name: string, arr: T[], separator = " ") {
const value = arr.map(escape).join(separator)
const txt = `::set-output name=${name}::${value}`
return Deno.stdout.write(encode(`${txt}\n`))
}
//TODO HTML escapes probs
function escape<T>(input: T): string {
const out = `${input}`
if (/[<>~]/.test(out)) {
return `"${out}"`
} else {
return out
}
}