Skip to content

Commit 8557470

Browse files
tillgansterTGANSTE
andauthored
feat: support no_proxy environment variable (#1205)
Co-authored-by: TGANSTE <till.ganster@mercedes-benz.com>
1 parent 10db758 commit 8557470

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/octokit-client.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ export const Octokit = Core.plugin(
1111
autoProxyAgent
1212
)
1313

14-
// Octokit plugin to support the https_proxy environment variable
14+
// Octokit plugin to support the https_proxy and no_proxy environment variable
1515
function autoProxyAgent(octokit: Core) {
1616
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY
17+
18+
const noProxy = process.env.no_proxy || process.env.NO_PROXY
19+
let noProxyArray: string[] = []
20+
if (noProxy) {
21+
noProxyArray = noProxy.split(',')
22+
}
23+
1724
if (!proxy) return
1825

1926
const agent = new HttpsProxyAgent(proxy)
2027
octokit.hook.before('request', options => {
28+
if (noProxyArray.includes(options.request.hostname)) {
29+
return
30+
}
2131
options.request.agent = agent
2232
})
2333
}

0 commit comments

Comments
 (0)