From 59f1e72dec9d09048af4ab16a6bb6bd7db84cdb4 Mon Sep 17 00:00:00 2001 From: wolfy Date: Mon, 1 Jun 2026 20:41:34 -0500 Subject: [PATCH] idk --- action.yml | 23 +---------------------- bootstrap.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 22 deletions(-) create mode 100644 bootstrap.ts diff --git a/action.yml b/action.yml index 8bdf168..acdca2c 100644 --- a/action.yml +++ b/action.yml @@ -22,28 +22,7 @@ inputs: runs: using: "node24" - main: "entry.ts" - post-if: "always()" + main: "bootstrap.ts" # BOT_TOKEN, OLLAMA_HOST, and GITEA_URL must be set as env vars by the consuming workflow. # GITHUB_EVENT_NAME, GITHUB_EVENT_PATH, and GITHUB_REPOSITORY are set by the runner. - -# runs: -# using: composite -# steps: -# - uses: oven-sh/setup-bun@v2 - -# - name: Install dependencies -# shell: bash -# working-directory: ${{ github.action_path }} -# run: bun install --frozen-lockfile - -# - name: Run shockbot -# shell: bash -# working-directory: ${{ github.action_path }} -# env: -# INPUT_PROMPT: ${{ inputs.prompt }} -# INPUT_MODEL: ${{ inputs.model }} -# INPUT_CONTEXT_WINDOW: ${{ inputs.context_window }} -# INPUT_MAX_TOOL_CALLS: ${{ inputs.max_tool_calls }} -# run: bun run entry.ts diff --git a/bootstrap.ts b/bootstrap.ts new file mode 100644 index 0000000..293619d --- /dev/null +++ b/bootstrap.ts @@ -0,0 +1,18 @@ +import { existsSync } from "node:fs"; +import { execSync } from "node:child_process"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; + +const dir = dirname(fileURLToPath(import.meta.url)); + +if (!existsSync(`${dir}/node_modules`)) { + console.log("node_modules not found, installing dependencies..."); + try { + execSync("bun install --frozen-lockfile", { stdio: "inherit", cwd: dir, timeout: 120_000 }); + } catch { + console.log("bun unavailable, falling back to npm..."); + execSync("npm install --no-fund --no-audit", { stdio: "inherit", cwd: dir, timeout: 120_000 }); + } +} + +await import("./entry.ts");