From 6423fe3683f1068950a70e4c46ab7950f670e3e8 Mon Sep 17 00:00:00 2001 From: Parker Brown <17183625+parkerbxyz@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:10:57 -0700 Subject: [PATCH] Add bootstrap entry for env-based proxy support Introduces bootstrap.js to set NODE_USE_ENV_PROXY before loading main.js, ensuring proxy support is enabled unless explicitly opted out. Updates action.yml to use bootstrap as the main entry and modifies build script to bundle bootstrap.js. --- action.yml | 2 +- bootstrap.js | 7 +++++++ main.js | 2 -- package.json | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 bootstrap.js diff --git a/action.yml b/action.yml index 2461e2a..2b5d045 100644 --- a/action.yml +++ b/action.yml @@ -133,5 +133,5 @@ outputs: description: "GitHub App slug" runs: using: "node24" - main: "dist/main.cjs" + main: "dist/bootstrap.cjs" post: "dist/post.cjs" diff --git a/bootstrap.js b/bootstrap.js new file mode 100644 index 0000000..845c7a3 --- /dev/null +++ b/bootstrap.js @@ -0,0 +1,7 @@ +// Enable env-based proxy support (honors explicit opt-out if caller set NODE_USE_ENV_PROXY) +if (process.env.NODE_USE_ENV_PROXY == null) { + process.env.NODE_USE_ENV_PROXY = "1"; +} + +// Defer to original main entry (dynamic import ensures above code runs first) +await import("./main.js"); diff --git a/main.js b/main.js index bc11c6d..094abed 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,4 @@ // @ts-check -process.env.NODE_USE_ENV_PROXY = "1"; - import core from "@actions/core"; import { createAppAuth } from "@octokit/auth-app"; diff --git a/package.json b/package.json index a2e5ffa..2123f18 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "node": ">=24.4.0" }, "scripts": { - "build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --packages=bundle", + "build": "esbuild bootstrap.js main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --packages=bundle", "test": "c8 --100 ava tests/index.js", "coverage": "c8 report --reporter html", "postcoverage": "open-cli coverage/index.html"