Log whether the proxy is picked up on

This commit is contained in:
Michael B. Gale
2026-07-14 17:02:07 +01:00
parent b946565527
commit 47e9c29998
2 changed files with 14 additions and 4 deletions

6
lib/entry-points.js generated
View File

@@ -145629,8 +145629,12 @@ function getRegistryProxy(action) {
const port = action.env.getOptional("CODEQL_PROXY_PORT" /* PROXY_PORT */);
const cert = action.env.getOptional("CODEQL_PROXY_CA_CERTIFICATE" /* PROXY_CA_CERTIFICATE */);
if (host && port) {
const uri = `http://${host}:${port}`;
action.logger.debug(
`Using private registry proxy at '${uri}' for API client.`
);
return new import_undici.ProxyAgent({
uri: `http://${host}:${port}`,
uri,
keepAliveTimeout: 10,
keepAliveMaxTimeout: 10,
requestTls: cert ? { ca: cert } : void 0

View File

@@ -66,15 +66,19 @@ export interface GitHubApiExternalRepoDetails {
* or `undefined` if we couldn't retrieve the host and port.
*/
export function getRegistryProxy(
action: ActionState<["Env"]>,
action: ActionState<["Logger", "Env"]>,
): ProxyAgent | undefined {
const host = action.env.getOptional(RegistryProxyVars.PROXY_HOST);
const port = action.env.getOptional(RegistryProxyVars.PROXY_PORT);
const cert = action.env.getOptional(RegistryProxyVars.PROXY_CA_CERTIFICATE);
if (host && port) {
const uri = `http://${host}:${port}`;
action.logger.debug(
`Using private registry proxy at '${uri}' for API client.`,
);
return new ProxyAgent({
uri: `http://${host}:${port}`,
uri,
keepAliveTimeout: 10,
keepAliveMaxTimeout: 10,
requestTls: cert ? { ca: cert } : undefined,
@@ -107,7 +111,9 @@ export function makeProxyRequestOptions(
*
* @param action The required Action state.
*/
export function getApiFetch(action: ActionState<["Env"]>): typeof undiciFetch {
export function getApiFetch(
action: ActionState<["Logger", "Env"]>,
): typeof undiciFetch {
const dispatcher = getRegistryProxy(action);
const proxiedFetch = (req: RequestInfo, init?: RequestInit) => {