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

Update octokit graphql type dependencies #228

Merged
merged 2 commits into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/github/RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @actions/github Releases

### 2.0.0

- Upgrade Octokit version to 4.x to include typescript types [#228](https://github.com/actions/toolkit/pull/228)

### 1.1.0

- Accept Octokit.Options in the GitHub constructor [#113](https://github.com/actions/toolkit/pull/113)
Expand Down
84 changes: 52 additions & 32 deletions packages/github/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actions/github",
"version": "1.1.0",
"version": "2.0.0",
"description": "Actions github lib",
"keywords": [
"github",
Expand All @@ -27,13 +27,15 @@
"scripts": {
"test": "jest",
"build": "tsc",
"format": "prettier --write **/*.ts",
hross marked this conversation as resolved.
Show resolved Hide resolved
"format-check": "prettier --check **/*.ts",
"tsc": "tsc"
},
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"dependencies": {
"@octokit/graphql": "^2.0.1",
"@octokit/graphql": "^4.3.1",
"@octokit/rest": "^16.15.0"
hross marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
Expand Down
36 changes: 0 additions & 36 deletions packages/github/src/@types/@octokit/index.d.ts

This file was deleted.

7 changes: 2 additions & 5 deletions packages/github/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ export class Context {
readFileSync(process.env.GITHUB_EVENT_PATH, {encoding: 'utf8'})
)
} else {
process.stdout.write(
hross marked this conversation as resolved.
Show resolved Hide resolved
`GITHUB_EVENT_PATH ${
process.env.GITHUB_EVENT_PATH
} does not exist${EOL}`
)
const path = process.env.GITHUB_EVENT_PATH
process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${EOL}`)
}
}
this.eventName = process.env.GITHUB_EVENT_NAME as string
Expand Down
16 changes: 10 additions & 6 deletions packages/github/src/github.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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}`}
})
}
Expand Down