Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gitea): use configured endpoint in PR cache #33121

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/modules/platform/gitea/pr-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,16 @@ export class GiteaPrCache {
}

private async sync(http: GiteaHttp): Promise<GiteaPrCache> {
const query = getQueryString({
const urlPath = `${API_PATH}/repos/${this.repo}/pulls`;
const queryParams = {
state: 'all',
sort: 'recentupdate',
});
};

let page: number = 1;
const query = getQueryString(queryParams);
let url: string | undefined =
`${API_PATH}/repos/${this.repo}/pulls?${query}`;
`${urlPath}?${query}`;

while (url) {
const res: HttpResponse<PR[]> = await http.getJson<PR[]>(url, {
Expand All @@ -134,7 +137,12 @@ export class GiteaPrCache {
break;
}

url = parseLinkHeader(res.headers.link)?.next?.url;
page += 1;
const query = getQueryString({
...queryParams,
page
});
url = `${urlPath}?${query}`;
}

return this;
Expand Down