Merge pull request #113 from actions/client-options
Accept Octokit.Options in the GitHub constructor
This commit is contained in:
commit
0149c9fcca
2 files changed
+4
-2
No files matched your search
@@ -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
|
||||||
|
|||||||
+2
-2
@@ -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}`}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user