Skip to content

Commit

Permalink
Add additionalPlugins parameter to getOctokit method (#1181)
Browse files Browse the repository at this point in the history
* Add additionalPlugins parameter to getOctokit method

* Simplify getOctokit
  • Loading branch information
luketomlinson committed Sep 22, 2022
1 parent 64c334f commit 94de2cf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/github/src/github.ts
Expand Up @@ -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()

Expand All @@ -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))
}

0 comments on commit 94de2cf

Please sign in to comment.