mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-11-18 16:11:07 +08:00
Add additionalPlugins parameter to getOctokit method (#1181)
* Add additionalPlugins parameter to getOctokit method * Simplify getOctokit
This commit is contained in:
parent
64c334f0e5
commit
94de2cf6d4
@ -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))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user