mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-03 21:43:17 +08:00
Update dependencies in github package (#1553)
* Update octokit package * define type for function * fix linter * Update github package to latest * Update RELEASES.md
This commit is contained in:
committed by
GitHub
parent
797f48fcfa
commit
494f12bcd9
@@ -1,6 +1,7 @@
|
||||
import * as http from 'http'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
import {ProxyAgent, fetch} from 'undici'
|
||||
|
||||
export function getAuthString(
|
||||
token: string,
|
||||
@@ -20,6 +21,24 @@ export function getProxyAgent(destinationUrl: string): http.Agent {
|
||||
return hc.getAgent(destinationUrl)
|
||||
}
|
||||
|
||||
export function getProxyAgentDispatcher(
|
||||
destinationUrl: string
|
||||
): ProxyAgent | undefined {
|
||||
const hc = new httpClient.HttpClient()
|
||||
return hc.getAgentDispatcher(destinationUrl)
|
||||
}
|
||||
|
||||
export function getProxyFetch(destinationUrl): typeof fetch {
|
||||
const httpDispatcher = getProxyAgentDispatcher(destinationUrl)
|
||||
const proxyFetch: typeof fetch = async (url, opts) => {
|
||||
return fetch(url, {
|
||||
...opts,
|
||||
dispatcher: httpDispatcher
|
||||
})
|
||||
}
|
||||
return proxyFetch
|
||||
}
|
||||
|
||||
export function getApiBaseUrl(): string {
|
||||
return process.env['GITHUB_API_URL'] || 'https://api.github.com'
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ const baseUrl = Utils.getApiBaseUrl()
|
||||
export const defaults: OctokitOptions = {
|
||||
baseUrl,
|
||||
request: {
|
||||
agent: Utils.getProxyAgent(baseUrl)
|
||||
agent: Utils.getProxyAgent(baseUrl),
|
||||
fetch: Utils.getProxyFetch(baseUrl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user