docs: allow skipping github issues (#29221)

This commit is contained in:
Michael Kriese 2024-05-23 12:35:36 +02:00 committed by GitHub
parent 4a0ec6c92f
commit 249b50f3d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ const gitHubApiUrl = 'https://api.github.com/search/issues?';
const githubApi = new GithubHttp(); const githubApi = new GithubHttp();
if (process.env.GITHUB_TOKEN) { if (process.env.GITHUB_TOKEN) {
logger.debug('Using GITHUB_TOKEN from env'); logger.info('Using GITHUB_TOKEN from env');
hostRules.add({ hostRules.add({
matchHost: 'api.github.com', matchHost: 'api.github.com',
token: process.env.GITHUB_TOKEN, token: process.env.GITHUB_TOKEN,
@ -47,6 +47,18 @@ export interface Items {
} }
export async function getOpenGitHubItems(): Promise<RenovateOpenItems> { export async function getOpenGitHubItems(): Promise<RenovateOpenItems> {
const result: RenovateOpenItems = {
managers: {},
platforms: {},
datasources: {},
versionings: {},
};
if (process.env.SKIP_GITHUB_ISSUES) {
logger.warn('Skipping GitHub issues');
return result;
}
const q = `repo:renovatebot/renovate type:issue is:open`; const q = `repo:renovatebot/renovate type:issue is:open`;
const per_page = 100; const per_page = 100;
try { try {
@ -60,20 +72,18 @@ export async function getOpenGitHubItems(): Promise<RenovateOpenItems> {
); );
const rawItems = res.body?.items ?? []; const rawItems = res.body?.items ?? [];
const renovateOpenItems: RenovateOpenItems = { result.managers = extractIssues(rawItems, 'manager:');
managers: extractIssues(rawItems, 'manager:'), result.platforms = extractIssues(rawItems, 'platform:');
platforms: extractIssues(rawItems, 'platform:'), result.datasources = extractIssues(rawItems, 'datasource:');
datasources: extractIssues(rawItems, 'datasource:'), result.versionings = extractIssues(rawItems, 'versioning:');
versionings: extractIssues(rawItems, 'versioning:'),
};
return renovateOpenItems; return result;
} catch (err) { } catch (err) {
logger.error({ err }, 'Error getting query results'); logger.error({ err }, 'Error getting query results');
if (process.env.CI) { if (process.env.CI) {
throw err; throw err;
} }
return { managers: {}, platforms: {}, datasources: {}, versionings: {} }; return result;
} }
} }