54e58b612c
This PR switches proxy support to Node's native env-proxy handling and makes the required configuration explicit. ## What changed - fail fast in both `main` and `post` when proxy configuration is present without `NODE_USE_ENV_PROXY=1` - document the supported proxy configuration in `README.md` - add regression tests for the proxy guard in both entrypoints - keep the existing successful end-to-end coverage and add a smaller proxy-specific workflow check that enables native proxy support, points `https_proxy` at an unreachable proxy, and asserts the action fails - update the test workflow so the same checks also run on pushes to `beta` ## Proxy configuration When using `HTTP_PROXY` or `HTTPS_PROXY`, set `NODE_USE_ENV_PROXY=1` on the action step. If you need bypass rules, set `NO_PROXY` alongside them. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import { readdirSync } from "node:fs";
|
||
|
||
import test from "ava";
|
||
import { execa } from "execa";
|
||
|
||
// Get all files in tests directory
|
||
const files = readdirSync("tests");
|
||
|
||
// Files to ignore
|
||
const ignore = ["index.js", "main.js", "README.md", "snapshots"];
|
||
|
||
const testFiles = files.filter((file) => !ignore.includes(file));
|
||
|
||
// Throw an error if there is a file that does not end with test.js in the tests directory
|
||
for (const file of testFiles) {
|
||
if (!file.endsWith(".test.js")) {
|
||
throw new Error(`File ${file} does not end with .test.js`);
|
||
}
|
||
test(file, async (t) => {
|
||
// Override Actions environment variables that change `core`’s behavior
|
||
const env = {
|
||
GITHUB_OUTPUT: undefined,
|
||
GITHUB_STATE: undefined,
|
||
HTTP_PROXY: undefined,
|
||
HTTPS_PROXY: undefined,
|
||
http_proxy: undefined,
|
||
https_proxy: undefined,
|
||
NO_PROXY: undefined,
|
||
no_proxy: undefined,
|
||
NODE_OPTIONS: undefined,
|
||
NODE_USE_ENV_PROXY: undefined,
|
||
};
|
||
const { stderr, stdout } = await execa("node", [`tests/${file}`], { env });
|
||
t.snapshot(stderr, "stderr");
|
||
t.snapshot(stdout, "stdout");
|
||
});
|
||
}
|