- add support for NO_PROXY setup
- Based on https://github.com/tillganster/create-pull-request/blob/f9980167df95c66e46f8a787ae951954cb5cfc6d/src/octokit-client.ts
This commit is contained in:
@@ -43,21 +43,29 @@ export class ReleaseNotesBuilder {
|
|||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// check proxy setup for GHES environments
|
// check proxy setup for GHES environments
|
||||||
let agent = undefined
|
|
||||||
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
||||||
if (proxy) {
|
const noProxy = process.env.no_proxy || process.env.NO_PROXY
|
||||||
agent = new HttpsProxyAgent(proxy)
|
let noProxyArray: string[] = []
|
||||||
|
if (noProxy) {
|
||||||
|
noProxyArray = noProxy.split(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
// load octokit instance
|
// load octokit instance
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: `token ${this.token || process.env.GITHUB_TOKEN}`,
|
auth: `token ${this.token || process.env.GITHUB_TOKEN}`,
|
||||||
baseUrl: `${this.baseUrl || 'https://api.github.com'}`,
|
baseUrl: `${this.baseUrl || 'https://api.github.com'}`
|
||||||
request: {
|
|
||||||
agent
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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
|
// ensure proper from <-> to tag range
|
||||||
core.startGroup(`🔖 Resolve tags`)
|
core.startGroup(`🔖 Resolve tags`)
|
||||||
const tagsApi = new Tags(octokit)
|
const tagsApi = new Tags(octokit)
|
||||||
|
|||||||
Reference in New Issue
Block a user