1
0
Fork 0

Add additionalPlugins parameter to getOctokit method (#1181)

* Add additionalPlugins parameter to getOctokit method

* Simplify getOctokit
pull/1182/head
Luke Tomlinson 2022-09-22 16:43:54 -04:00 committed by GitHub
parent 64c334f0e5
commit 94de2cf6d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import * as Context from './context'
import {GitHub, getOctokitOptions} from './utils'
// octokit + plugins
import {OctokitOptions} from '@octokit/core/dist-types/types'
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
export const context = new Context.Context()
@ -14,7 +14,9 @@ export const context = new Context.Context()
*/
export function getOctokit(
token: string,
options?: OctokitOptions
options?: OctokitOptions,
...additionalPlugins: OctokitPlugin[]
): InstanceType<typeof GitHub> {
return new GitHub(getOctokitOptions(token, options))
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
return new GitHubWithPlugins(getOctokitOptions(token, options))
}