Skip to content

Commit

Permalink
fix(package): update @octokit/rest to version 16.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and pvdlg committed Jan 22, 2019
1 parent 1b7e473 commit 7e4378d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/find-sr-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ISSUE_ID = require('./definitions/sr-issue-id');
module.exports = async (github, title, owner, repo) => {
const {
data: {items: issues},
} = await github.search.issues({
} = await github.search.issuesAndPullRequests({
q: `in:title+repo:${owner}/${repo}+type:issue+state:open+${title}`,
});

Expand Down
15 changes: 8 additions & 7 deletions lib/get-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
const baseUrl = githubUrl && urljoin(githubUrl, githubApiPathPrefix);
const globalThrottler = new Bottleneck({minTime: GLOBAL_RATE_LIMIT});
const github = new Octokit({
auth: `token ${githubToken}`,
baseUrl,
agent: proxy
? baseUrl && url.parse(baseUrl).protocol.replace(':', '') === 'http'
? new HttpProxyAgent(proxy)
: new HttpsProxyAgent(proxy)
: undefined,
request: {
agent: proxy
? baseUrl && url.parse(baseUrl).protocol.replace(':', '') === 'http'
? new HttpProxyAgent(proxy)
: new HttpsProxyAgent(proxy)
: undefined,
},
});

github.hook.wrap('request', (request, options) => {
Expand All @@ -56,7 +59,5 @@ module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
}, RETRY_CONF);
});

github.authenticate({type: 'token', token: githubToken});

return github;
};
2 changes: 1 addition & 1 deletion lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = async (pluginConfig, context) => {
const shas = commits.map(({hash}) => hash);

const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
async q => (await github.search.issues({q})).data.items
async q => (await github.search.issuesAndPullRequests({q})).data.items
);

const prs = await pFilter(
Expand Down
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": "^16.0.1",
"@octokit/rest": "^16.13.1",
"@semantic-release/error": "^2.2.0",
"aggregate-error": "^2.0.0",
"bottleneck": "^2.0.1",
Expand Down
12 changes: 6 additions & 6 deletions test/get-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ test('Use the global throttler for all endpoints', async t => {
const b = await github.issues.createComment();
const c = await github.repos.createRelease();
const d = await github.issues.createComment();
const e = await github.search.issues();
const f = await github.search.issues();
const e = await github.search.issuesAndPullRequests();
const f = await github.search.issuesAndPullRequests();

// `issues.createComment` should be called `rate` ms after `repos.createRelease`
t.true(inRange(b - a, rate - 50, rate + 50));
// `repos.createRelease` should be called `rate` ms after `issues.createComment`
t.true(inRange(c - b, rate - 50, rate + 50));
// `issues.createComment` should be called `rate` ms after `repos.createRelease`
t.true(inRange(d - c, rate - 50, rate + 50));
// `search.issues` should be called `rate` ms after `issues.createComment`
// `search.issuesAndPullRequests` should be called `rate` ms after `issues.createComment`
t.true(inRange(e - d, rate - 50, rate + 50));
// `search.issues` should be called `rate` ms after `search.issues`
// `search.issuesAndPullRequests` should be called `rate` ms after `search.issuesAndPullRequests`
t.true(inRange(f - e, rate - 50, rate + 50));
});

Expand All @@ -130,8 +130,8 @@ test('Use the same throttler for endpoints in the same rate limit group', async
const b = await github.issues.createComment();
const c = await github.repos.createRelease();
const d = await github.issues.createComment();
const e = await github.search.issues();
const f = await github.search.issues();
const e = await github.search.issuesAndPullRequests();
const f = await github.search.issuesAndPullRequests();

// `issues.createComment` should be called `coreRate` ms after `repos.createRelease`
t.true(inRange(b - a, coreRate - 50, coreRate + 50));
Expand Down

0 comments on commit 7e4378d

Please sign in to comment.