From 72c86c7bbfbe51b9b5d4c2dbaf0de59d4e9b2d6a Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Sat, 27 Jun 2020 12:24:14 +0200 Subject: [PATCH] fix(gitea): fetch both open and closed issues (#6604) --- lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap | 4 ++-- lib/platform/gitea/gitea-helper.spec.ts | 4 ++-- lib/platform/gitea/gitea-helper.ts | 2 +- lib/platform/gitea/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap b/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap index ed53fce4ec7fc5..355712ff2d91fd 100644 --- a/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap +++ b/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap @@ -571,7 +571,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "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", }, "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", }, ] `; diff --git a/lib/platform/gitea/gitea-helper.spec.ts b/lib/platform/gitea/gitea-helper.spec.ts index 5115c9ebb85eb7..2117b298377355 100644 --- a/lib/platform/gitea/gitea-helper.spec.ts +++ b/lib/platform/gitea/gitea-helper.spec.ts @@ -461,7 +461,7 @@ describe('platform/gitea/gitea-helper', () => { it('should call /api/v1/repos/[repo]/issues endpoint', async () => { httpMock .scope(baseUrl) - .get(`/repos/${mockRepo.full_name}/issues`) + .get(`/repos/${mockRepo.full_name}/issues?type=issues`) .reply(200, [mockIssue]); const res = await ght.searchIssues(mockRepo.full_name, {}); @@ -472,7 +472,7 @@ describe('platform/gitea/gitea-helper', () => { it('should construct proper query parameters', async () => { httpMock .scope(baseUrl) - .get(`/repos/${mockRepo.full_name}/issues?state=open`) + .get(`/repos/${mockRepo.full_name}/issues?state=open&type=issues`) .reply(200, [mockIssue]); const res = await ght.searchIssues(mockRepo.full_name, { diff --git a/lib/platform/gitea/gitea-helper.ts b/lib/platform/gitea/gitea-helper.ts index 60ba5f35d38a74..120220940d5306 100644 --- a/lib/platform/gitea/gitea-helper.ts +++ b/lib/platform/gitea/gitea-helper.ts @@ -379,7 +379,7 @@ export async function searchIssues( params: IssueSearchParams, options?: GiteaHttpOptions ): Promise { - const query = queryParams(params).toString(); + const query = queryParams({ ...params, type: 'issues' }).toString(); const url = `repos/${repoPath}/issues?${query}`; const res = await giteaHttp.getJson(url, { ...options, diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index 5a394fbbf34b8b..9552a8e3fe6cc4 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -467,7 +467,7 @@ const platform: Platform = { getPrList(): Promise { if (config.prList === null) { config.prList = helper - .searchPRs(config.repository, {}, { useCache: false }) + .searchPRs(config.repository, { state: 'all' }, { useCache: false }) .then((prs) => { const prList = prs.map(toRenovatePR).filter(Boolean); logger.debug(`Retrieved ${prList.length} Pull Requests`); @@ -632,7 +632,7 @@ const platform: Platform = { getIssueList(): Promise { if (config.issueList === null) { config.issueList = helper - .searchIssues(config.repository, {}, { useCache: false }) + .searchIssues(config.repository, { state: 'all' }, { useCache: false }) .then((issues) => { const issueList = issues.map(toRenovateIssue); logger.debug(`Retrieved ${issueList.length} Issues`);