Skip to content

Commit 94de2cf

Browse files
Add additionalPlugins parameter to getOctokit method (actions#1181)
* Add additionalPlugins parameter to getOctokit method * Simplify getOctokit
1 parent 64c334f commit 94de2cf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/github/src/github.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Context from './context'
22
import {GitHub, getOctokitOptions} from './utils'
33

44
// octokit + plugins
5-
import {OctokitOptions} from '@octokit/core/dist-types/types'
5+
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
66

77
export const context = new Context.Context()
88

@@ -14,7 +14,9 @@ export const context = new Context.Context()
1414
*/
1515
export function getOctokit(
1616
token: string,
17-
options?: OctokitOptions
17+
options?: OctokitOptions,
18+
...additionalPlugins: OctokitPlugin[]
1819
): InstanceType<typeof GitHub> {
19-
return new GitHub(getOctokitOptions(token, options))
20+
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
21+
return new GitHubWithPlugins(getOctokitOptions(token, options))
2022
}

0 commit comments

Comments
 (0)