diff --git a/src/validateTitle.js b/src/validateTitle.js index 25d842d5..57b28a95 100644 --- a/src/validateTitle.js +++ b/src/validateTitle.js @@ -13,14 +13,17 @@ module.exports = async function validateTitle(preset, title) { const { parserOpts } = conventionalChangelogConfig; const result = parser(title, parserOpts); + const allowedTypes = Object.keys(conventionalCommitTypes.types); + if (!result.type) { throw new Error( - `No release type found in pull request title "${title}".` + - '\n\nAdd a prefix like "fix: ", "feat: " or "feat!: " to indicate what kind of release this pull request corresponds to. The title should match the commit mesage format as specified by https://www.conventionalcommits.org/.' + `No release type found in pull request title "${title}". The title should match the commit message format as specified by https://www.conventionalcommits.org/. The functionalities can also be altered by the selected preset plugin (${preset}). ` + + `\n\nPlease use one of these recognized types: ${allowedTypes.join( + ', ' + )}.` ); } - const allowedTypes = Object.keys(conventionalCommitTypes.types); if (!allowedTypes.includes(result.type)) { throw new Error( `Unknown release type "${result.type}" found in pull request title "${title}".` +