Skip to content

Commit

Permalink
Merge pull request #113 from actions/client-options
Browse files Browse the repository at this point in the history
Accept Octokit.Options in the GitHub constructor
  • Loading branch information
jclem authored Sep 5, 2019
2 parents eb4c328 + 1c4866f commit 7772d5f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 2 additions & 0 deletions packages/github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/github/src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`}
})
Expand Down

0 comments on commit 7772d5f

Please sign in to comment.