Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additionalPlugins parameter to getOctokit method #1181

Merged
merged 2 commits into from Sep 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 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,12 @@ export const context = new Context.Context()
*/
export function getOctokit(
token: string,
options?: OctokitOptions
options?: OctokitOptions,
...additionalPlugins: OctokitPlugin[]
luketomlinson marked this conversation as resolved.
Show resolved Hide resolved
): InstanceType<typeof GitHub> {
if (additionalPlugins.length) {
luketomlinson marked this conversation as resolved.
Show resolved Hide resolved
luketomlinson marked this conversation as resolved.
Show resolved Hide resolved
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
return new GitHubWithPlugins(getOctokitOptions(token, options))
}
return new GitHub(getOctokitOptions(token, options))
}