From 13d59ede850d2e47d7885021313440d663868d9f Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Wed, 8 Jun 2022 09:43:05 +0200
Subject: [PATCH] chore: Revert "docs: add per manager known list of issues"
 (#15936)

---
 tools/docs/github-query-items.ts |  16 -----
 tools/docs/manager.ts            | 111 -------------------------------
 2 files changed, 127 deletions(-)
 delete mode 100644 tools/docs/github-query-items.ts

diff --git a/tools/docs/github-query-items.ts b/tools/docs/github-query-items.ts
deleted file mode 100644
index f9668ce59b..0000000000
--- a/tools/docs/github-query-items.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-export type GithubApiQueryResponse = {
-  total_count: number;
-  incomplete_results: boolean;
-  items: ItemsEntity[];
-};
-
-export type ItemsEntity = {
-  html_url: string;
-  number: number;
-  title: string;
-  labels: LabelsEntity[];
-};
-
-export type LabelsEntity = {
-  name: string;
-};
diff --git a/tools/docs/manager.ts b/tools/docs/manager.ts
index bbf6ce0a42..b8bb426982 100644
--- a/tools/docs/manager.ts
+++ b/tools/docs/manager.ts
@@ -1,20 +1,8 @@
-import { DateTime } from 'luxon';
 import type { RenovateConfig } from '../../lib/config/types';
-import { logger } from '../../lib/logger';
 import { getManagers } from '../../lib/modules/manager';
-import { GithubHttp } from '../../lib/util/http/github';
-import { getQueryString } from '../../lib/util/url';
 import { readFile, updateFile } from '../utils';
-import type { GithubApiQueryResponse, ItemsEntity } from './github-query-items';
 import { getDisplayName, getNameWithUrl, replaceContent } from './utils';
 
-const gitHubApiUrl = 'https://api.github.com/search/issues?';
-
-interface ManagerIssues {
-  bugs: ItemsEntity[];
-  features: ItemsEntity[];
-}
-
 function getTitle(manager: string, displayName: string): string {
   if (manager === 'regex') {
     return `Custom Manager Support using Regex`;
@@ -26,84 +14,8 @@ function getManagerLink(manager: string): string {
   return `[\`${manager}\`](${manager}/)`;
 }
 
-function stringifyIssues(items: ItemsEntity[]): [string, number] {
-  if (!items) {
-    return ['', 0];
-  }
-  let list = '';
-  for (const item of items) {
-    list += ` - ${item.title} [#${item.number}](${item.html_url})\n`;
-  }
-  return [list, items.length];
-}
-
-function extractIssues(
-  managerIssuesMap: Record<string, ManagerIssues>,
-  items: ItemsEntity[]
-): void {
-  if (!items || !managerIssuesMap) {
-    return;
-  }
-  for (const item of items) {
-    const type = item.labels
-      .find((l) => l.name.startsWith('type:'))
-      ?.name.split(':')[1];
-    if (!type) {
-      continue;
-    }
-    const manager = item.labels
-      .find((l) => l.name.startsWith('manager:'))
-      ?.name.split(':')[1];
-    if (!manager) {
-      continue;
-    }
-    if (!managerIssuesMap[manager]) {
-      managerIssuesMap[manager] = { bugs: [], features: [] };
-    }
-    switch (type) {
-      case 'bug':
-        managerIssuesMap[manager].bugs.push(item);
-        break;
-      case 'feature':
-        managerIssuesMap[manager].features.push(item);
-        break;
-      default:
-        break;
-    }
-  }
-}
-
-export async function getManagersGitHubIssues(): Promise<
-  Record<string, ManagerIssues>
-> {
-  const q = `repo:renovatebot/renovate type:issue is:open -label:priority-5-triage`;
-  const per_page = 100;
-  const managerIssuesMap: Record<string, ManagerIssues> = {};
-  const githubApi = new GithubHttp('manager-issues');
-  try {
-    const query = getQueryString({ q, per_page });
-    const res = await githubApi.getJson<GithubApiQueryResponse>(
-      gitHubApiUrl + query,
-      {
-        paginationField: 'items',
-        paginate: true,
-      }
-    );
-    const items = res.body?.items ?? [];
-    extractIssues(
-      managerIssuesMap,
-      items.sort((a, b) => a.number - b.number)
-    );
-  } catch (err) {
-    logger.error({ err }, 'Error getting query results');
-    throw err;
-  }
-  return managerIssuesMap;
-}
-
 export async function generateManagers(dist: string): Promise<void> {
   const managers = getManagers();
-  const managerIssuesMap = await getManagersGitHubIssues();
   const allLanguages: Record<string, string[]> = {};
   for (const [manager, definition] of managers) {
     const language = definition.language ?? 'other';
@@ -161,29 +73,6 @@ sidebar_label: ${displayName}
     }
     md += managerReadmeContent + '\n\n';
 
-    const [featureList] = stringifyIssues(managerIssuesMap[manager]?.features);
-    if (featureList) {
-      md += '## Open feature requests\n\n';
-      md += featureList;
-      md += '\n';
-    }
-
-    const [bugList] = stringifyIssues(managerIssuesMap[manager]?.bugs);
-    if (bugList) {
-      md += '## Open bug reports\n\n';
-      md += bugList;
-      md += '\n';
-    }
-
-    if (featureList || bugList) {
-      const now = DateTime.utc().toFormat('MMMM dd, yyyy');
-      const lists = `list of ${featureList ? 'features' : ''}${
-        featureList && bugList ? ' and ' : ''
-      }${bugList ? 'bugs' : ''}`;
-      md += '\n\n';
-      md += `The above ${lists} were current when this page was generated on ${now}.\n`;
-    }
-
     await updateFile(`${dist}/modules/manager/${manager}/index.md`, md);
   }
   const languages = Object.keys(allLanguages).filter(
-- 
GitLab