mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 14:36:25 +00:00
Merge be61d66295
into 19a99d2ca9
This commit is contained in:
commit
3d3301fe16
1 changed files with 14 additions and 5 deletions
|
@ -118,13 +118,16 @@ export class GiteaPrCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async sync(http: GiteaHttp): Promise<GiteaPrCache> {
|
private async sync(http: GiteaHttp): Promise<GiteaPrCache> {
|
||||||
const query = getQueryString({
|
const urlPath = `${API_PATH}/repos/${this.repo}/pulls`;
|
||||||
|
const queryParams = {
|
||||||
state: 'all',
|
state: 'all',
|
||||||
sort: 'recentupdate',
|
sort: 'recentupdate',
|
||||||
});
|
};
|
||||||
|
|
||||||
|
let page: number = 1;
|
||||||
|
const query = getQueryString(queryParams);
|
||||||
let url: string | undefined =
|
let url: string | undefined =
|
||||||
`${API_PATH}/repos/${this.repo}/pulls?${query}`;
|
`${urlPath}?${query}`;
|
||||||
|
|
||||||
while (url) {
|
while (url) {
|
||||||
const res: HttpResponse<PR[]> = await http.getJson<PR[]>(url, {
|
const res: HttpResponse<PR[]> = await http.getJson<PR[]>(url, {
|
||||||
|
@ -133,11 +136,17 @@ export class GiteaPrCache {
|
||||||
});
|
});
|
||||||
|
|
||||||
const needNextPage = this.reconcile(res.body);
|
const needNextPage = this.reconcile(res.body);
|
||||||
if (!needNextPage) {
|
const nextUrl: string | undefined = parseLinkHeader(res.headers.link)?.next?.url;
|
||||||
|
if (!needNextPage || res.body.length === 0 || nextUrl === undefined) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = parseLinkHeader(res.headers.link)?.next?.url;
|
page += 1;
|
||||||
|
const query = getQueryString({
|
||||||
|
...queryParams,
|
||||||
|
page
|
||||||
|
});
|
||||||
|
url = `${urlPath}?${query}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateItems();
|
this.updateItems();
|
||||||
|
|
Loading…
Reference in a new issue