Skip to content

Commit

Permalink
fix: adapt for @octokit/[email protected] (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m authored Mar 13, 2018
1 parent 8649d86 commit 7b6bc95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions lib/get-client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const url = require('url');
const {memoize} = require('lodash');
const Octokit = require('@octokit/rest');
const pRetry = require('p-retry');
const Bottleneck = require('bottleneck');
const urljoin = require('url-join');

/**
* Default exponential backoff configuration for retries.
Expand Down Expand Up @@ -101,13 +101,8 @@ module.exports = ({
limit = RATE_LIMITS,
globalLimit = GLOBAL_RATE_LIMIT,
}) => {
const {port, protocol, hostname} = githubUrl ? url.parse(githubUrl) : {};
const github = new Octokit({
port,
protocol: (protocol || '').split(':')[0] || undefined,
host: hostname,
pathPrefix: githubApiPathPrefix,
});
const baseUrl = githubUrl && urljoin(githubUrl, githubApiPathPrefix);
const github = new Octokit({baseUrl});
github.authenticate({type: 'token', token: githubToken});
return new Proxy(github, handler(retry, limit, new Bottleneck({minTime: globalLimit})));
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Gregor Martynus (https://twitter.com/gr2m)"
],
"dependencies": {
"@octokit/rest": "^15.1.7",
"@octokit/rest": "^15.2.0",
"@semantic-release/error": "^2.2.0",
"aggregate-error": "^1.0.0",
"bottleneck": "^2.0.1",
Expand Down

0 comments on commit 7b6bc95

Please sign in to comment.