Files
bot-agents/src/prepare.ts
T
Danny Kim 8f23da2b42
Agents / agent (pull_request) Has been skipped
Check / check (pull_request) Successful in 58s
Move the action from Deno to Node.js and Vite+
2026-10-16 02:20:49 +09:00

25 lines
633 B
TypeScript

import { appendFile, rm } from "node:fs/promises";
import process from "node:process";
import { prepareRuntime } from "./runtime.ts";
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;
}