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.
This commit is contained in:
Parker Brown
2025-08-22 13:10:57 -07:00
parent 39808af6a2
commit 6423fe3683
4 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -133,5 +133,5 @@ outputs:
description: "GitHub App slug"
runs:
using: "node24"
main: "dist/main.cjs"
main: "dist/bootstrap.cjs"
post: "dist/post.cjs"
+7
View File
@@ -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");
-2
View File
@@ -1,6 +1,4 @@
// @ts-check
process.env.NODE_USE_ENV_PROXY = "1";
import core from "@actions/core";
import { createAppAuth } from "@octokit/auth-app";
+1 -1
View File
@@ -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"