Merge pull request #880 from mikepenz/feature/no_proxy

Support `NO_PROXY` env config
This commit is contained in:
Mike Penz
2022-08-26 10:58:57 +02:00
committed by GitHub
3 changed files with 30 additions and 15 deletions
Generated Vendored
+14 -7
View File
@@ -1004,19 +1004,26 @@ class ReleaseNotesBuilder {
}
core.endGroup();
// check proxy setup for GHES environments
let agent = undefined;
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY;
if (proxy) {
agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
const noProxy = process.env.no_proxy || process.env.NO_PROXY;
let noProxyArray = [];
if (noProxy) {
noProxyArray = noProxy.split(',');
}
// load octokit instance
const octokit = new rest_1.Octokit({
auth: `token ${this.token || process.env.GITHUB_TOKEN}`,
baseUrl: `${this.baseUrl || 'https://api.github.com'}`,
request: {
agent
}
baseUrl: `${this.baseUrl || 'https://api.github.com'}`
});
if (proxy) {
const agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
octokit.hook.before('request', options => {
if (noProxyArray.includes(options.request.hostname)) {
return;
}
options.request.agent = agent;
});
}
// ensure proper from <-> to tag range
core.startGroup(`🔖 Resolve tags`);
const tagsApi = new tags_1.Tags(octokit);
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+15 -7
View File
@@ -43,21 +43,29 @@ export class ReleaseNotesBuilder {
core.endGroup()
// check proxy setup for GHES environments
let agent = undefined
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY
if (proxy) {
agent = new HttpsProxyAgent(proxy)
const noProxy = process.env.no_proxy || process.env.NO_PROXY
let noProxyArray: string[] = []
if (noProxy) {
noProxyArray = noProxy.split(',')
}
// load octokit instance
const octokit = new Octokit({
auth: `token ${this.token || process.env.GITHUB_TOKEN}`,
baseUrl: `${this.baseUrl || 'https://api.github.com'}`,
request: {
agent
}
baseUrl: `${this.baseUrl || 'https://api.github.com'}`
})
if (proxy) {
const agent = new HttpsProxyAgent(proxy)
octokit.hook.before('request', options => {
if (noProxyArray.includes(options.request.hostname)) {
return
}
options.request.agent = agent
})
}
// ensure proper from <-> to tag range
core.startGroup(`🔖 Resolve tags`)
const tagsApi = new Tags(octokit)