Files
bot-agents/src/prepare/index.ts
T
Danny Kim 063eb09750 Replace NodeJS dict aliases with maps and named field reads
Co-authored-by: Danny Kim <temeddix@gmail.com>
Co-committed-by: Danny Kim <temeddix@gmail.com>
2026-10-20 05:01:49 +00:00

25 lines
629 B
TypeScript

import { appendFile, rm } from "node:fs/promises";
import process from "node:process";
import { prepareRuntime } from "#runtime";
const env = (name: string): string => {
const value = process.env[name];
if (value === undefined || value === "") {
throw new Error(`${name} is not set`);
}
return value;
};
const manifest = await prepareRuntime(
env("ACTION_PATH"),
env("RUNNER_TEMP"),
env("BOT_AGENTS_MASTER_KEY"),
);
try {
await appendFile(env("GITHUB_OUTPUT"), `manifest=${manifest.manifestPath}\n`);
} catch (error) {
await rm(manifest.runtimeDir, { recursive: true }).catch(() => {});
throw error;
}