From 3d86ac632ffd5c3578c10eb54d172eb3d4850487 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 3 Feb 2021 09:45:08 +0100 Subject: [PATCH] fix: include more template fields --- lib/util/template/index.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/util/template/index.ts b/lib/util/template/index.ts index 6ca14c0157..469b8b149c 100644 --- a/lib/util/template/index.ts +++ b/lib/util/template/index.ts @@ -11,6 +11,8 @@ handlebars.registerHelper('replace', (find, replace, context) => ); export const exposedConfigOptions = [ + 'additionalBranchPrefix', + 'addLabels', 'branchName', 'branchPrefix', 'branchTopic', @@ -21,10 +23,8 @@ export const exposedConfigOptions = [ 'commitMessageSuffix', 'commitMessageTopic', 'group', - 'groupSlug', 'groupName', - 'additionalBranchPrefix', - 'addLabels', + 'groupSlug', 'labels', 'prBodyColumns', 'prBodyDefinitions', @@ -87,7 +87,22 @@ export const allowedFields = { versions: 'An array of ChangeLogRelease objects in the upgrade', }; -const allowedFieldsList = Object.keys(allowedFields); +const prBodyFields = [ + 'header', + 'table', + 'notes', + 'changelogs', + 'configDescription', + 'controls', + 'footer', +]; + +const handlebarsUtilityFields = ['else']; + +const allowedFieldsList = Object.keys(allowedFields) + .concat(exposedConfigOptions) + .concat(prBodyFields) + .concat(handlebarsUtilityFields); type CompileInput = Record<string, unknown>; @@ -126,7 +141,7 @@ export function compile( for (const match of matches) { const varName = match[3]; if (!allowedFieldsList.includes(varName)) { - logger.warn( + logger.info( { varName, template }, 'Disallowed variable name in template' ); -- GitLab