Skip to content

Commit 47e9c29

Browse files
committed
Log whether the proxy is picked up on
1 parent b946565 commit 47e9c29

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/api-client.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@ export interface GitHubApiExternalRepoDetails {
6666
* or `undefined` if we couldn't retrieve the host and port.
6767
*/
6868
export function getRegistryProxy(
69-
action: ActionState<["Env"]>,
69+
action: ActionState<["Logger", "Env"]>,
7070
): ProxyAgent | undefined {
7171
const host = action.env.getOptional(RegistryProxyVars.PROXY_HOST);
7272
const port = action.env.getOptional(RegistryProxyVars.PROXY_PORT);
7373
const cert = action.env.getOptional(RegistryProxyVars.PROXY_CA_CERTIFICATE);
7474

7575
if (host && port) {
76+
const uri = `http://${host}:${port}`;
77+
action.logger.debug(
78+
`Using private registry proxy at '${uri}' for API client.`,
79+
);
7680
return new ProxyAgent({
77-
uri: `http://${host}:${port}`,
81+
uri,
7882
keepAliveTimeout: 10,
7983
keepAliveMaxTimeout: 10,
8084
requestTls: cert ? { ca: cert } : undefined,
@@ -107,7 +111,9 @@ export function makeProxyRequestOptions(
107111
*
108112
* @param action The required Action state.
109113
*/
110-
export function getApiFetch(action: ActionState<["Env"]>): typeof undiciFetch {
114+
export function getApiFetch(
115+
action: ActionState<["Logger", "Env"]>,
116+
): typeof undiciFetch {
111117
const dispatcher = getRegistryProxy(action);
112118

113119
const proxiedFetch = (req: RequestInfo, init?: RequestInit) => {

0 commit comments

Comments
 (0)