Skip to content

Commit 7772d5f

Browse files
authored
Merge pull request actions#113 from actions/client-options
Accept Octokit.Options in the GitHub constructor
2 parents eb4c328 + 1c4866f commit 7772d5f

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"lerna": "^3.13.3",
2727
"prettier": "^1.17.0",
2828
"ts-jest": "^24.0.2",
29-
"typescript": "^3.4.4"
29+
"typescript": "^3.6.2"
3030
}
3131
}

packages/github/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const { data: pullRequest } = await octokit.pulls.get({
2727
console.log(pullRequest);
2828
```
2929

30+
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.
31+
3032
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
3133

3234
```js

packages/github/src/github.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export class GitHub extends Octokit {
1414
variables?: Variables
1515
) => Promise<GraphQlQueryResponse>
1616

17-
constructor(token: string) {
18-
super({auth: `token ${token}`})
17+
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
18+
super({...opts, auth: `token ${token}`})
1919
this.graphql = defaults({
2020
headers: {authorization: `token ${token}`}
2121
})

0 commit comments

Comments
 (0)