diff --git a/lib/modules/platform/github/index.spec.ts b/lib/modules/platform/github/index.spec.ts index 51b25a6d9515570f820109195d48f816eddf6ef2..0789f597bcb2058fd1b6b24abea8cd2e8aebddb5 100644 --- a/lib/modules/platform/github/index.spec.ts +++ b/lib/modules/platform/github/index.spec.ts @@ -174,9 +174,15 @@ describe('modules/platform/github/index', () => { .reply(200, [ { full_name: 'a/b', + archived: false, }, { full_name: 'c/d', + archived: false, + }, + { + full_name: 'e/f', + archived: true, }, null, ]); @@ -227,9 +233,15 @@ describe('modules/platform/github/index', () => { repositories: [ { full_name: 'a/b', + archived: false, }, { full_name: 'c/d', + archived: false, + }, + { + full_name: 'e/f', + archived: true, }, null, ], diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts index 8f5bdab301d5ab5864812bcae29e19d26b355c4f..1fb1e521a00e74271bcbbef6ffd7a4a40ac6c569 100644 --- a/lib/modules/platform/github/index.ts +++ b/lib/modules/platform/github/index.ts @@ -191,20 +191,24 @@ export async function getRepos(): Promise<string[]> { try { if (platformConfig.isGHApp) { const res = await githubApi.getJson<{ - repositories: { full_name: string }[]; + repositories: GhRestRepo[]; }>(`installation/repositories?per_page=100`, { paginationField: 'repositories', paginate: 'all', }); return res.body.repositories .filter(is.nonEmptyObject) + .filter((repo) => !repo.archived) .map((repo) => repo.full_name); } else { - const res = await githubApi.getJson<{ full_name: string }[]>( + const res = await githubApi.getJson<GhRestRepo[]>( `user/repos?per_page=100`, { paginate: 'all' } ); - return res.body.filter(is.nonEmptyObject).map((repo) => repo.full_name); + return res.body + .filter(is.nonEmptyObject) + .filter((repo) => !repo.archived) + .map((repo) => repo.full_name); } } catch (err) /* istanbul ignore next */ { logger.error({ err }, `GitHub getRepos error`); diff --git a/lib/modules/platform/github/types.ts b/lib/modules/platform/github/types.ts index fd06dcf31b2d82312ce95b8c5d2adb5c06567111..ef01406661370ba3fb352567642a5a84a8b13d08 100644 --- a/lib/modules/platform/github/types.ts +++ b/lib/modules/platform/github/types.ts @@ -26,6 +26,7 @@ export interface GhRestRepo { owner: { login: string; }; + archived: boolean; } export interface GhRestPr {