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
|
||||
},
|
||||
"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": {
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}`}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue