@actions/github v3 using Octokit/core (#453)

* Rebuild to use @Octokit/Core
This commit is contained in:
Thomas Boop authored and GitHub committed 2020-06-02 21:39:46 -04:00
1 parent a8c0896b1e
commit 1bc87e2271
8 files changed
+311 -319

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import * as http from 'http'
import * as httpClient from '@actions/http-client'
import {OctokitOptions} from '@octokit/core/dist-types/types'
export function getAuthString(
token: string,
options: OctokitOptions
): string | undefined {
if (!token && !options.auth) {
throw new Error('Parameter token or opts.auth is required')
} else if (token && options.auth) {
throw new Error('Parameters token and opts.auth may not both be specified')
}
return typeof options.auth === 'string' ? options.auth : `token ${token}`
}
export function getProxyAgent(destinationUrl: string): http.Agent {
const hc = new httpClient.HttpClient()
return hc.getAgent(destinationUrl)
}
export function getApiBaseUrl(): string {
return process.env['GITHUB_API_URL'] || 'https://api.github.com'
}