1
0
Fork 0
toolkit/packages/github/src/github.ts

23 lines
680 B
TypeScript
Raw Normal View History

import * as Context from './context'
import {GitHub, getOctokitOptions} from './utils'
// octokit + plugins
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
2019-08-05 12:53:51 +00:00
export const context = new Context.Context()
/**
* Returns a hydrated octokit ready to use for GitHub Actions
*
* @param token the repo PAT or GITHUB_TOKEN
* @param options other options to set
*/
export function getOctokit(
token: string,
options?: OctokitOptions,
...additionalPlugins: OctokitPlugin[]
): InstanceType<typeof GitHub> {
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
return new GitHubWithPlugins(getOctokitOptions(token, options))
}