1
0
Fork 0

Merge pull request #113 from actions/client-options

Accept Octokit.Options in the GitHub constructor
pull/114/head
Jonathan Clem 2019-09-05 10:58:15 -04:00 committed by GitHub
commit 7772d5f810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

6
package-lock.json generated
View File

@ -9530,9 +9530,9 @@
"dev": true
},
"typescript": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.4.tgz",
"integrity": "sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==",
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz",
"integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==",
"dev": true
},
"uglify-js": {

View File

@ -26,6 +26,6 @@
"lerna": "^3.13.3",
"prettier": "^1.17.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.4"
"typescript": "^3.6.2"
}
}

View File

@ -27,6 +27,8 @@ const { data: pullRequest } = await octokit.pulls.get({
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.
```js

View File

@ -14,8 +14,8 @@ export class GitHub extends Octokit {
variables?: Variables
) => Promise<GraphQlQueryResponse>
constructor(token: string) {
super({auth: `token ${token}`})
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
super({...opts, auth: `token ${token}`})
this.graphql = defaults({
headers: {authorization: `token ${token}`}
})