mc-publish/test/utils/input-utils.ts
2021-09-25 15:44:49 +03:00

15 lines
431 B
TypeScript

import process from "process";
export function setupInput(input: Record<string, any>): void {
for (const [key, value] of Object.entries(input)) {
process.env[`INPUT_${key.replace(/ /g, "_").toUpperCase()}`] = value.toString();
}
}
export function unsetInput(): void {
for (const key of Object.keys(process.env)) {
if (key.startsWith("INPUT_")) {
delete process.env[key];
}
}
}