From 94de2cf6d446e4afd3d7b66408e7c513633dddaa Mon Sep 17 00:00:00 2001 From: Luke Tomlinson Date: Thu, 22 Sep 2022 16:43:54 -0400 Subject: [PATCH] Add additionalPlugins parameter to getOctokit method (#1181) * Add additionalPlugins parameter to getOctokit method * Simplify getOctokit --- packages/github/src/github.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/github/src/github.ts b/packages/github/src/github.ts index bada7e52..b4ed7133 100644 --- a/packages/github/src/github.ts +++ b/packages/github/src/github.ts @@ -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 { - return new GitHub(getOctokitOptions(token, options)) + const GitHubWithPlugins = GitHub.plugin(...additionalPlugins) + return new GitHubWithPlugins(getOctokitOptions(token, options)) }