fix(gitea): fetch both open and closed issues (#6604)

This commit is contained in:
Cirno the Strongest 2020-06-27 12:24:14 +02:00 committed by GitHub
parent dd636ed15c
commit 72c86c7bbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -571,7 +571,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate", "user-agent": "https://github.com/renovatebot/renovate",
}, },
"method": "GET", "method": "GET",
"url": "https://gitea.renovatebot.com/api/v1/repos/some/repo/issues?", "url": "https://gitea.renovatebot.com/api/v1/repos/some/repo/issues?type=issues",
}, },
] ]
`; `;
@ -586,7 +586,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate", "user-agent": "https://github.com/renovatebot/renovate",
}, },
"method": "GET", "method": "GET",
"url": "https://gitea.renovatebot.com/api/v1/repos/some/repo/issues?state=open", "url": "https://gitea.renovatebot.com/api/v1/repos/some/repo/issues?state=open&type=issues",
}, },
] ]
`; `;

View file

@ -461,7 +461,7 @@ describe('platform/gitea/gitea-helper', () => {
it('should call /api/v1/repos/[repo]/issues endpoint', async () => { it('should call /api/v1/repos/[repo]/issues endpoint', async () => {
httpMock httpMock
.scope(baseUrl) .scope(baseUrl)
.get(`/repos/${mockRepo.full_name}/issues`) .get(`/repos/${mockRepo.full_name}/issues?type=issues`)
.reply(200, [mockIssue]); .reply(200, [mockIssue]);
const res = await ght.searchIssues(mockRepo.full_name, {}); const res = await ght.searchIssues(mockRepo.full_name, {});
@ -472,7 +472,7 @@ describe('platform/gitea/gitea-helper', () => {
it('should construct proper query parameters', async () => { it('should construct proper query parameters', async () => {
httpMock httpMock
.scope(baseUrl) .scope(baseUrl)
.get(`/repos/${mockRepo.full_name}/issues?state=open`) .get(`/repos/${mockRepo.full_name}/issues?state=open&type=issues`)
.reply(200, [mockIssue]); .reply(200, [mockIssue]);
const res = await ght.searchIssues(mockRepo.full_name, { const res = await ght.searchIssues(mockRepo.full_name, {

View file

@ -379,7 +379,7 @@ export async function searchIssues(
params: IssueSearchParams, params: IssueSearchParams,
options?: GiteaHttpOptions options?: GiteaHttpOptions
): Promise<Issue[]> { ): Promise<Issue[]> {
const query = queryParams(params).toString(); const query = queryParams({ ...params, type: 'issues' }).toString();
const url = `repos/${repoPath}/issues?${query}`; const url = `repos/${repoPath}/issues?${query}`;
const res = await giteaHttp.getJson<Issue[]>(url, { const res = await giteaHttp.getJson<Issue[]>(url, {
...options, ...options,

View file

@ -467,7 +467,7 @@ const platform: Platform = {
getPrList(): Promise<Pr[]> { getPrList(): Promise<Pr[]> {
if (config.prList === null) { if (config.prList === null) {
config.prList = helper config.prList = helper
.searchPRs(config.repository, {}, { useCache: false }) .searchPRs(config.repository, { state: 'all' }, { useCache: false })
.then((prs) => { .then((prs) => {
const prList = prs.map(toRenovatePR).filter(Boolean); const prList = prs.map(toRenovatePR).filter(Boolean);
logger.debug(`Retrieved ${prList.length} Pull Requests`); logger.debug(`Retrieved ${prList.length} Pull Requests`);
@ -632,7 +632,7 @@ const platform: Platform = {
getIssueList(): Promise<Issue[]> { getIssueList(): Promise<Issue[]> {
if (config.issueList === null) { if (config.issueList === null) {
config.issueList = helper config.issueList = helper
.searchIssues(config.repository, {}, { useCache: false }) .searchIssues(config.repository, { state: 'all' }, { useCache: false })
.then((issues) => { .then((issues) => {
const issueList = issues.map(toRenovateIssue); const issueList = issues.map(toRenovateIssue);
logger.debug(`Retrieved ${issueList.length} Issues`); logger.debug(`Retrieved ${issueList.length} Issues`);