mirror of https://github.com/actions/toolkit
Merge pull request #113 from actions/client-options
Accept Octokit.Options in the GitHub constructorpull/114/head
commit
7772d5f810
|
@ -9530,9 +9530,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.4.4",
|
"version": "3.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz",
|
||||||
"integrity": "sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==",
|
"integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
|
|
|
@ -26,6 +26,6 @@
|
||||||
"lerna": "^3.13.3",
|
"lerna": "^3.13.3",
|
||||||
"prettier": "^1.17.0",
|
"prettier": "^1.17.0",
|
||||||
"ts-jest": "^24.0.2",
|
"ts-jest": "^24.0.2",
|
||||||
"typescript": "^3.4.4"
|
"typescript": "^3.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ const { data: pullRequest } = await octokit.pulls.get({
|
||||||
console.log(pullRequest);
|
console.log(pullRequest);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can pass client options (except `auth`, which is handled by the token argument), as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor.
|
||||||
|
|
||||||
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -14,8 +14,8 @@ export class GitHub extends Octokit {
|
||||||
variables?: Variables
|
variables?: Variables
|
||||||
) => Promise<GraphQlQueryResponse>
|
) => Promise<GraphQlQueryResponse>
|
||||||
|
|
||||||
constructor(token: string) {
|
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
|
||||||
super({auth: `token ${token}`})
|
super({...opts, auth: `token ${token}`})
|
||||||
this.graphql = defaults({
|
this.graphql = defaults({
|
||||||
headers: {authorization: `token ${token}`}
|
headers: {authorization: `token ${token}`}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue