mirror of https://github.com/actions/toolkit
Add additionalPlugins parameter to getOctokit method (#1181)
* Add additionalPlugins parameter to getOctokit method * Simplify getOctokitpull/1182/head
parent
64c334f0e5
commit
94de2cf6d4
|
@ -2,7 +2,7 @@ import * as Context from './context'
|
||||||
import {GitHub, getOctokitOptions} from './utils'
|
import {GitHub, getOctokitOptions} from './utils'
|
||||||
|
|
||||||
// octokit + plugins
|
// 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()
|
export const context = new Context.Context()
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ export const context = new Context.Context()
|
||||||
*/
|
*/
|
||||||
export function getOctokit(
|
export function getOctokit(
|
||||||
token: string,
|
token: string,
|
||||||
options?: OctokitOptions
|
options?: OctokitOptions,
|
||||||
|
...additionalPlugins: OctokitPlugin[]
|
||||||
): InstanceType<typeof GitHub> {
|
): InstanceType<typeof GitHub> {
|
||||||
return new GitHub(getOctokitOptions(token, options))
|
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
|
||||||
|
return new GitHubWithPlugins(getOctokitOptions(token, options))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue