forked from actions/toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.ts
More file actions
22 lines (19 loc) · 680 Bytes
/
github.ts
File metadata and controls
22 lines (19 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as Context from './context'
import {GitHub, getOctokitOptions} from './utils'
// octokit + plugins
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
export const context = new Context.Context()
/**
* Returns a hydrated octokit ready to use for GitHub Actions
*
* @param token the repo PAT or GITHUB_TOKEN
* @param options other options to set
*/
export function getOctokit(
token: string,
options?: OctokitOptions,
...additionalPlugins: OctokitPlugin[]
): InstanceType<typeof GitHub> {
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
return new GitHubWithPlugins(getOctokitOptions(token, options))
}