From 6a8ceab6883cd0ba030f1cc4a3b21384ad73fc62 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 8 May 2020 12:20:24 +0200 Subject: [PATCH] refactor: move changelog retrieval to renovateRepository --- lib/workers/repository/index.ts | 7 +++++++ lib/workers/repository/process/extract-update.ts | 5 +---- lib/workers/repository/updates/branchify.ts | 4 ---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/workers/repository/index.ts b/lib/workers/repository/index.ts index 7613bb64f2..3bae15e916 100644 --- a/lib/workers/repository/index.ts +++ b/lib/workers/repository/index.ts @@ -11,6 +11,7 @@ import { ensureMasterIssue } from './master-issue'; import { ensureOnboardingPr } from './onboarding/pr'; import { extractDependencies, updateRepo } from './process'; import { ProcessResult, processResult } from './result'; +import { getChangeLogJSON } from '../pr/changelog'; let renovateVersion = 'unknown'; try { @@ -38,6 +39,12 @@ export async function renovateRepository( config ); await ensureOnboardingPr(config, packageFiles, branches); + for (const branch of branches) { + for (const upgrade of branch.upgrades) { + upgrade.logJSON = await getChangeLogJSON(upgrade); + } + } + addSplit('changelogs'); const res = await updateRepo(config, branches, branchList); addSplit('update'); if (res !== 'automerged') { diff --git a/lib/workers/repository/process/extract-update.ts b/lib/workers/repository/process/extract-update.ts index 5a78f3bc1f..756e10e65b 100644 --- a/lib/workers/repository/process/extract-update.ts +++ b/lib/workers/repository/process/extract-update.ts @@ -57,9 +57,6 @@ export async function extract(config: RenovateConfig): Promise<ExtractResult> { ); logger.trace({ config: packageFiles }, 'packageFiles'); await fetchUpdates(config, packageFiles); - addSplit( - config.baseBranches?.length ? `lookup:${config.baseBranch}` : 'lookup' - ); logger.debug({ config: packageFiles }, 'packageFiles with updates'); await raiseDeprecationWarnings(config, packageFiles); const { branches, branchList } = await branchifyUpgrades( @@ -68,7 +65,7 @@ export async function extract(config: RenovateConfig): Promise<ExtractResult> { ); sortBranches(branches); addSplit( - config.baseBranches?.length ? `branchify:${config.baseBranch}` : 'branchify' + config.baseBranches?.length ? `lookup:${config.baseBranch}` : 'lookup' ); return { branches, branchList, packageFiles }; } diff --git a/lib/workers/repository/updates/branchify.ts b/lib/workers/repository/updates/branchify.ts index 6113b1b0a6..e2aa1903d0 100644 --- a/lib/workers/repository/updates/branchify.ts +++ b/lib/workers/repository/updates/branchify.ts @@ -4,7 +4,6 @@ import { RenovateConfig, ValidationMessage } from '../../../config'; import { addMeta, logger, removeMeta } from '../../../logger'; import * as template from '../../../util/template'; import { BranchConfig, BranchUpgradeConfig } from '../../common'; -import { getChangeLogJSON } from '../../pr/changelog'; import { flattenUpdates } from './flatten'; import { generateBranchConfig } from './generate'; import { Merge } from 'type-fest'; @@ -115,9 +114,6 @@ export async function branchifyUpgrades( addMeta({ branch: branchName, }); - for (const upgrade of branchUpgrades[branchName]) { - upgrade.logJSON = await getChangeLogJSON(upgrade); - } const seenUpdates = {}; // Filter out duplicates branchUpgrades[branchName] = branchUpgrades[branchName].filter( -- GitLab