Update octokit graphql type dependencies (#228)
* Update GraphQL support in base API
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
|
||||
import {GraphQlQueryResponse, Variables, defaults} from '@octokit/graphql'
|
||||
import {graphql} from '@octokit/graphql'
|
||||
|
||||
// we need this type to set up a property on the GitHub object
|
||||
// that has token authorization
|
||||
// (it is not exported from octokit by default)
|
||||
import {graphql as GraphQL} from '@octokit/graphql/dist-types/types'
|
||||
|
||||
import Octokit from '@octokit/rest'
|
||||
import * as Context from './context'
|
||||
|
||||
@@ -9,14 +15,12 @@ Octokit.prototype = new Octokit()
|
||||
export const context = new Context.Context()
|
||||
|
||||
export class GitHub extends Octokit {
|
||||
graphql: (
|
||||
query: string,
|
||||
variables?: Variables
|
||||
) => Promise<GraphQlQueryResponse>
|
||||
graphql: GraphQL
|
||||
|
||||
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
|
||||
super({...opts, auth: `token ${token}`})
|
||||
this.graphql = defaults({
|
||||
|
||||
this.graphql = graphql.defaults({
|
||||
headers: {authorization: `token ${token}`}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user