Drop Deno from the agents and spawn child processes directly
Check / check (pull_request) Successful in 2m26s
Agents / agent (pull_request) Has been skipped

This commit is contained in:
Danny Kim
2026-10-16 23:26:28 +09:00
parent 006bbe6b0c
commit 50328caac5
21 changed files with 294 additions and 390 deletions
+7 -9
View File
@@ -1,10 +1,9 @@
import { spawnSync } from "node:child_process";
import process from "node:process";
import { fileURLToPath } from "node:url";
import { expect, test } from "vite-plus/test";
import { output } from "../src/command.ts";
// Each phase runs as `node src/<phase>.ts` with no build step. Node loads the
// whole import graph, stripping types, before the phase reads its first
// variable, so failing on that variable proves every module loads.
@@ -14,14 +13,13 @@ const PHASES: [phase: string, firstVariable: string][] = [
["post", "BOT_AGENTS_MANIFEST"],
];
test.each(PHASES)("Node loads the %s phase", async (phase, firstVariable) => {
test.each(PHASES)("Node loads the %s phase", (phase, firstVariable) => {
const path = fileURLToPath(new URL(`../src/${phase}.ts`, import.meta.url));
const result = await output(process.execPath, {
args: [path],
const result = spawnSync(process.execPath, [path], {
env: { PATH: process.env.PATH ?? "" },
clearEnv: true,
stdin: "null",
stdio: ["ignore", "pipe", "pipe"],
encoding: "utf8",
});
expect(result.success).toBe(false);
expect(new TextDecoder().decode(result.stderr)).toContain(`${firstVariable} is not set`);
expect(result.status).not.toBe(0);
expect(result.stderr).toContain(`${firstVariable} is not set`);
});
+15 -6
View File
@@ -1,10 +1,10 @@
import { spawnSync } from "node:child_process";
import { readdir, readFile, rm, stat } from "node:fs/promises";
import process from "node:process";
import { assert, expect, test } from "vite-plus/test";
import { parse } from "yaml";
import { output } from "../src/command.ts";
import { isNotFound } from "../src/errors.ts";
import { isMapping } from "../src/json.ts";
import type { JsonObject } from "../src/json.ts";
@@ -76,12 +76,16 @@ test("the source protection script stages immutable action files", async () => {
const temp = await makeTempDir();
const outputFile = `${temp}/output`;
try {
const result = await output("/bin/bash", {
args: ["scripts/protect-source.sh"],
env: { ACTION_PATH: process.cwd(), GITHUB_OUTPUT: outputFile, RUNNER_TEMP: temp },
stderr: "piped",
const result = spawnSync("/bin/bash", ["scripts/protect-source.sh"], {
env: {
...process.env,
ACTION_PATH: process.cwd(),
GITHUB_OUTPUT: outputFile,
RUNNER_TEMP: temp,
},
encoding: "utf8",
});
assert(result.success, new TextDecoder().decode(result.stderr));
assert(result.status === 0, result.stderr);
const path = (await readFile(outputFile, "utf8")).trim().slice(5);
const files = [
@@ -160,6 +164,11 @@ test("installs the OpenCode CLI", async () => {
assert(action.includes("opencode-ai"));
});
test("does not install Deno", async () => {
const action = await readFile("action.yml", "utf8");
expect(action).not.toMatch(/\bdeno\b/iu);
});
test("profile preparation does not receive provider credentials", async () => {
const runner = await readFile("src/run.ts", "utf8");
assert(runner.includes("await prepareProfile(profile);"));