diff --git a/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap b/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap index f9c896a82a242987131942641be026a44b2e40f6..8e84dba5aee2b8d5ad1ae7eea46ae8584af1a13c 100644 --- a/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap +++ b/lib/platform/gitea/__snapshots__/gitea-helper.spec.ts.snap @@ -694,7 +694,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://gitea.renovatebot.com/api/v1/repos/search?uid=13", + "url": "https://gitea.renovatebot.com/api/v1/repos/search?uid=13&archived=false", }, ] `; diff --git a/lib/platform/gitea/__snapshots__/index.spec.ts.snap b/lib/platform/gitea/__snapshots__/index.spec.ts.snap index d455cb8940bf2366c10006c95407751265817ecc..45d8f593ea571e19ebdb8628256e7d20f43774c6 100644 --- a/lib/platform/gitea/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitea/__snapshots__/index.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`platform/gitea createPr should use base branch by default 1`] = ` +exports[`platform/gitea/index createPr should use base branch by default 1`] = ` Object { "body": "pr-body", "canMerge": true, @@ -18,7 +18,7 @@ Object { } `; -exports[`platform/gitea createPr should use default branch if requested 1`] = ` +exports[`platform/gitea/index createPr should use default branch if requested 1`] = ` Object { "body": "pr-body", "canMerge": true, @@ -36,7 +36,7 @@ Object { } `; -exports[`platform/gitea getPr should fallback to direct fetching if cache fails 1`] = ` +exports[`platform/gitea/index getPr should fallback to direct fetching if cache fails 1`] = ` Object { "body": "some random pull request", "canMerge": true, @@ -54,7 +54,7 @@ Object { } `; -exports[`platform/gitea getPr should return enriched pull request which exists if open 1`] = ` +exports[`platform/gitea/index getPr should return enriched pull request which exists if open 1`] = ` Object { "body": "some random pull request", "canMerge": true, @@ -72,14 +72,14 @@ Object { } `; -exports[`platform/gitea getPrList should filter list by creator 1`] = ` +exports[`platform/gitea/index getPrList should filter list by creator 1`] = ` Object { "endpoint": "https://gitea.com/api/v1/", "gitAuthor": "Renovate Bot <renovate@example.com>", } `; -exports[`platform/gitea getPrList should filter list by creator 2`] = ` +exports[`platform/gitea/index getPrList should filter list by creator 2`] = ` Array [ Object { "body": "some random pull request", @@ -114,7 +114,7 @@ Array [ ] `; -exports[`platform/gitea getPrList should return list of pull requests 1`] = ` +exports[`platform/gitea/index getPrList should return list of pull requests 1`] = ` Array [ Object { "body": "some random pull request", @@ -149,49 +149,49 @@ Array [ ] `; -exports[`platform/gitea getRepos should return an array of repos 1`] = ` +exports[`platform/gitea/index getRepos should return an array of repos 1`] = ` Array [ "a/b", "c/d", ] `; -exports[`platform/gitea initPlatform() should support custom endpoint 1`] = ` +exports[`platform/gitea/index initPlatform() should support custom endpoint 1`] = ` Object { "endpoint": "https://gitea.renovatebot.com/", "gitAuthor": "Renovate Bot <renovate@example.com>", } `; -exports[`platform/gitea initPlatform() should support default endpoint 1`] = ` +exports[`platform/gitea/index initPlatform() should support default endpoint 1`] = ` Object { "endpoint": "https://gitea.com/api/v1/", "gitAuthor": "Renovate Bot <renovate@example.com>", } `; -exports[`platform/gitea initPlatform() should use username as author name if full name is missing 1`] = ` +exports[`platform/gitea/index initPlatform() should use username as author name if full name is missing 1`] = ` Object { "endpoint": "https://gitea.com/api/v1/", "gitAuthor": "renovate <renovate@example.com>", } `; -exports[`platform/gitea initRepo should fall back to merge method "merge" 1`] = ` +exports[`platform/gitea/index initRepo should fall back to merge method "merge" 1`] = ` Object { "defaultBranch": "master", "isFork": false, } `; -exports[`platform/gitea initRepo should fall back to merge method "rebase-merge" 1`] = ` +exports[`platform/gitea/index initRepo should fall back to merge method "rebase-merge" 1`] = ` Object { "defaultBranch": "master", "isFork": false, } `; -exports[`platform/gitea initRepo should fall back to merge method "squash" 1`] = ` +exports[`platform/gitea/index initRepo should fall back to merge method "squash" 1`] = ` Object { "defaultBranch": "master", "isFork": false, diff --git a/lib/platform/gitea/gitea-helper.spec.ts b/lib/platform/gitea/gitea-helper.spec.ts index 2e74e949556113a39de8cdd1cc4d575711573ebc..fc0fdf292cb2ac8e38b6162b4e07c479d1969171 100644 --- a/lib/platform/gitea/gitea-helper.spec.ts +++ b/lib/platform/gitea/gitea-helper.spec.ts @@ -1,9 +1,10 @@ import * as httpMock from '../../../test/http-mock'; +import { getName } from '../../../test/util'; import { PrState } from '../../types'; import { setBaseUrl } from '../../util/http/gitea'; import * as ght from './gitea-helper'; -describe('platform/gitea/gitea-helper', () => { +describe(getName(__filename), () => { const baseUrl = 'https://gitea.renovatebot.com/api/v1'; const mockCommitHash = '0d9c7726c3d628b7e28af234595cfd20febdbf8e'; @@ -186,7 +187,7 @@ describe('platform/gitea/gitea-helper', () => { it('should construct proper query parameters', async () => { httpMock .scope(baseUrl) - .get('/repos/search?uid=13') + .get('/repos/search?uid=13&archived=false') .reply(200, { ok: true, data: [otherMockRepo], @@ -194,6 +195,7 @@ describe('platform/gitea/gitea-helper', () => { const res = await ght.searchRepos({ uid: 13, + archived: false, }); expect(res).toEqual([otherMockRepo]); expect(httpMock.getTrace()).toMatchSnapshot(); diff --git a/lib/platform/gitea/gitea-helper.ts b/lib/platform/gitea/gitea-helper.ts index 5d07710d2b286e22ff6c6a31b3b0957089a88877..f0c9a0b36c12833d378a3cee3b23c6d544a39ed8 100644 --- a/lib/platform/gitea/gitea-helper.ts +++ b/lib/platform/gitea/gitea-helper.ts @@ -132,6 +132,7 @@ export interface CombinedCommitStatus { export type RepoSearchParams = { uid?: number; + archived?: boolean; }; export type IssueCreateParams = IssueUpdateParams; diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index 1c9e57ff0032760a7ec37c4175ea105f16756c1d..6559c175e8b201584739f55b6d9b2841d2033aa0 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -1,5 +1,5 @@ import { BranchStatusConfig, Platform, RepoParams, RepoResult } from '..'; -import { partial } from '../../../test/util'; +import { getName, partial } from '../../../test/util'; import { REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, @@ -20,7 +20,7 @@ import * as ght from './gitea-helper'; */ const GITEA_VERSION = '1.14.0+dev-754-g5d2b7ba63'; -describe('platform/gitea', () => { +describe(getName(__filename), () => { let gitea: Platform; let helper: jest.Mocked<typeof import('./gitea-helper')>; let logger: jest.Mocked<typeof _logger>; diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index 49fd954094cc7d3b9bbed9cdd676dad940dea45d..0c6252f7e95b8135670019de5147eeb76011065a 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -314,7 +314,10 @@ const platform: Platform = { async getRepos(): Promise<string[]> { logger.debug('Auto-discovering Gitea repositories'); try { - const repos = await helper.searchRepos({ uid: botUserID }); + const repos = await helper.searchRepos({ + uid: botUserID, + archived: false, + }); return repos.map((r) => r.full_name); } catch (err) { logger.error({ err }, 'Gitea getRepos() error');