fix: issue pagination/filtering

This commit is contained in:
Rhys Arkins 2018-12-19 15:31:20 +01:00
parent 820a8a8ab5
commit e0d7784ddb
2 changed files with 9 additions and 7 deletions

View file

@ -57,7 +57,7 @@ async function get(path, options, retries = 5) {
const linkHeader = parseLinkHeader(res.headers.link);
if (linkHeader && linkHeader.next && linkHeader.last) {
let lastPage = +linkHeader.last.page;
if (!process.env.RENOVATE_PAGINATE_ALL) {
if (!process.env.RENOVATE_PAGINATE_ALL && opts.paginate !== 'all') {
lastPage = Math.min(pageLimit, lastPage);
}
const pageNumbers = Array.from(

View file

@ -624,18 +624,20 @@ async function getIssueList() {
const res = await get(
`repos/${config.parentRepo ||
config.repository}/issues?creator=${renovateUsername}&state=all&per_page=100&sort=created&direction=asc`,
{ paginate: true, useCache: false }
{ paginate: 'all', useCache: false }
);
// istanbul ignore if
if (!is.array(res.body)) {
logger.warn({ responseBody: res.body }, 'Could not retrieve issue list');
return [];
}
config.issueList = res.body.map(i => ({
number: i.number,
state: i.state,
title: i.title,
}));
config.issueList = res.body
.filter(issue => !issue.pull_request)
.map(i => ({
number: i.number,
state: i.state,
title: i.title,
}));
logger.debug('Retrieved ' + config.issueList.length + ' issues');
}
return config.issueList;