mirror of https://github.com/actions/toolkit
parent
1c12ced7ba
commit
5fdab2aaf2
|
@ -1,5 +1,9 @@
|
||||||
# @actions/github Releases
|
# @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
|
### 1.1.0
|
||||||
|
|
||||||
- Accept Octokit.Options in the GitHub constructor [#113](https://github.com/actions/toolkit/pull/113)
|
- Accept Octokit.Options in the GitHub constructor [#113](https://github.com/actions/toolkit/pull/113)
|
||||||
|
|
|
@ -384,64 +384,76 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/endpoint": {
|
"@octokit/endpoint": {
|
||||||
"version": "5.3.1",
|
"version": "5.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.1.tgz",
|
||||||
"integrity": "sha512-4mKqSQfeTRFpQMUGIUG1ewdQT64b2YpvjG2dE1x7nhQupdI/AjdgdcIsmPtRFEXlih/uLQLRWJL4FrivpQdC7A==",
|
"integrity": "sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"deepmerge": "4.0.0",
|
"@octokit/types": "^2.0.0",
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"universal-user-agent": "^3.0.0",
|
"universal-user-agent": "^4.0.0"
|
||||||
"url-template": "^2.0.8"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"universal-user-agent": {
|
"universal-user-agent": {
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
"integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
|
"integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"os-name": "^3.0.0"
|
"os-name": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/graphql": {
|
"@octokit/graphql": {
|
||||||
"version": "2.1.3",
|
"version": "4.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz",
|
||||||
"integrity": "sha512-XoXJqL2ondwdnMIW3wtqJWEwcBfKk37jO/rYkoxNPEVeLBDGsGO1TCWggrAlq3keGt/O+C/7VepXnukUxwt5vA==",
|
"integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/request": "^5.0.0",
|
"@octokit/request": "^5.3.0",
|
||||||
"universal-user-agent": "^2.0.3"
|
"@octokit/types": "^2.0.0",
|
||||||
|
"universal-user-agent": "^4.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"universal-user-agent": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
|
"requires": {
|
||||||
|
"os-name": "^3.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/request": {
|
"@octokit/request": {
|
||||||
"version": "5.0.1",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.1.tgz",
|
||||||
"integrity": "sha512-SHOk/APYpfrzV1RNf7Ux8SZi+vZXhMIB2dBr4TQR6ExMX8R4jcy/0gHw26HLe1dWV7Wxe9WzYyDSEC0XwnoCSQ==",
|
"integrity": "sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/endpoint": "^5.1.0",
|
"@octokit/endpoint": "^5.5.0",
|
||||||
"@octokit/request-error": "^1.0.1",
|
"@octokit/request-error": "^1.0.1",
|
||||||
|
"@octokit/types": "^2.0.0",
|
||||||
"deprecation": "^2.0.0",
|
"deprecation": "^2.0.0",
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"node-fetch": "^2.3.0",
|
"node-fetch": "^2.3.0",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
"universal-user-agent": "^3.0.0"
|
"universal-user-agent": "^4.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"universal-user-agent": {
|
"universal-user-agent": {
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
"integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
|
"integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"os-name": "^3.0.0"
|
"os-name": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/request-error": {
|
"@octokit/request-error": {
|
||||||
"version": "1.0.4",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.0.tgz",
|
||||||
"integrity": "sha512-L4JaJDXn8SGT+5G0uX79rZLv0MNJmfGa4vb4vy1NnpjSnWDLJRy6m90udGwvMmavwsStgbv2QNkPzzTCMmL+ig==",
|
"integrity": "sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@octokit/types": "^2.0.0",
|
||||||
"deprecation": "^2.0.0",
|
"deprecation": "^2.0.0",
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
|
@ -504,6 +516,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@octokit/types": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-StASIL2lgT3TRjxv17z9pAqbnI7HGu9DrJlg3sEBFfCLaMEqp+O3IQPUF6EZtQ4xkAu2ml6kMBBCtGxjvmtmuQ==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/babel__core": {
|
"@types/babel__core": {
|
||||||
"version": "7.1.2",
|
"version": "7.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.2.tgz",
|
||||||
|
@ -570,6 +590,11 @@
|
||||||
"@types/istanbul-lib-report": "*"
|
"@types/istanbul-lib-report": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "12.12.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.11.tgz",
|
||||||
|
"integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ=="
|
||||||
|
},
|
||||||
"@types/stack-utils": {
|
"@types/stack-utils": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
|
||||||
|
@ -1262,11 +1287,6 @@
|
||||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"deepmerge": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-YZ1rOP5+kHor4hMAH+HRQnBQHg+wvS1un1hAOuIcxcBy0hzcUf6Jg2a1w65kpoOUnurOfZbERwjI1TfZxNjcww=="
|
|
||||||
},
|
|
||||||
"define-properties": {
|
"define-properties": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"version": "1.1.0",
|
"version": "2.0.0",
|
||||||
"description": "Actions github lib",
|
"description": "Actions github lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
@ -27,13 +27,15 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
"format": "prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check **/*.ts",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/graphql": "^2.0.1",
|
"@octokit/graphql": "^4.3.1",
|
||||||
"@octokit/rest": "^16.15.0"
|
"@octokit/rest": "^16.15.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
declare module '@octokit/graphql' {
|
|
||||||
export interface GraphQlQueryResponse {
|
|
||||||
data: {[key: string]: any} | null
|
|
||||||
errors?: [
|
|
||||||
{
|
|
||||||
message: string
|
|
||||||
path: [string]
|
|
||||||
extensions: {[key: string]: any}
|
|
||||||
locations: [
|
|
||||||
{
|
|
||||||
line: number
|
|
||||||
column: number
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GraphQLError {
|
|
||||||
message: string
|
|
||||||
locations?: {line: number; column: number}[]
|
|
||||||
path?: (string | number)[]
|
|
||||||
extensions?: {
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Variables {
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export function defaults(
|
|
||||||
options: any
|
|
||||||
): (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>
|
|
||||||
}
|
|
|
@ -27,11 +27,8 @@ export class Context {
|
||||||
readFileSync(process.env.GITHUB_EVENT_PATH, {encoding: 'utf8'})
|
readFileSync(process.env.GITHUB_EVENT_PATH, {encoding: 'utf8'})
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
process.stdout.write(
|
const path = process.env.GITHUB_EVENT_PATH
|
||||||
`GITHUB_EVENT_PATH ${
|
process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${EOL}`)
|
||||||
process.env.GITHUB_EVENT_PATH
|
|
||||||
} does not exist${EOL}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.eventName = process.env.GITHUB_EVENT_NAME as string
|
this.eventName = process.env.GITHUB_EVENT_NAME as string
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
|
// 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 Octokit from '@octokit/rest'
|
||||||
import * as Context from './context'
|
import * as Context from './context'
|
||||||
|
|
||||||
|
@ -9,14 +15,12 @@ Octokit.prototype = new Octokit()
|
||||||
export const context = new Context.Context()
|
export const context = new Context.Context()
|
||||||
|
|
||||||
export class GitHub extends Octokit {
|
export class GitHub extends Octokit {
|
||||||
graphql: (
|
graphql: GraphQL
|
||||||
query: string,
|
|
||||||
variables?: Variables
|
|
||||||
) => Promise<GraphQlQueryResponse>
|
|
||||||
|
|
||||||
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
|
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
|
||||||
super({...opts, auth: `token ${token}`})
|
super({...opts, auth: `token ${token}`})
|
||||||
this.graphql = defaults({
|
|
||||||
|
this.graphql = graphql.defaults({
|
||||||
headers: {authorization: `token ${token}`}
|
headers: {authorization: `token ${token}`}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue