From 0d338d3071f454b871df38cc21da48e83dbd5a1b Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Sat, 27 Jun 2020 09:26:48 +0200 Subject: [PATCH 1/2] refactor(gitea): fetch both open and closed issues --- 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..08b1a057f6c8dc 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=issue", }, ] `; @@ -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=issue", }, ] `; diff --git a/lib/platform/gitea/gitea-helper.spec.ts b/lib/platform/gitea/gitea-helper.spec.ts index 5115c9ebb85eb7..b4f1c0e5cfe719 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=issue`) .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=issue`) .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..c63443e69cc195 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: 'issue' }).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 2fea422ce91b7b..6407339f62e603 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -465,7 +465,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`); @@ -630,7 +630,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`); From 3e408d63612b7a5330a588e53db9987fd55dc376 Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Sat, 27 Jun 2020 10:29:47 +0200 Subject: [PATCH 2/2] typo --- 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 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap b/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap index 08b1a057f6c8dc..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?type=issue", + "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&type=issue", + "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 b4f1c0e5cfe719..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?type=issue`) + .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&type=issue`) + .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 c63443e69cc195..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, type: 'issue' }).toString(); + const query = queryParams({ ...params, type: 'issues' }).toString(); const url = `repos/${repoPath}/issues?${query}`; const res = await giteaHttp.getJson(url, { ...options,