From fcbd2a1268d93774f603db68307b0224f669a014 Mon Sep 17 00:00:00 2001 From: gmaggiodev Date: Tue, 6 Oct 2020 17:50:52 +0200 Subject: [PATCH] support for preId --- index.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5afd556..b369c37 100644 --- a/index.js +++ b/index.js @@ -28,14 +28,28 @@ Toolkit.run(async tools => { const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',') const minorWords = process.env['INPUT_MINOR-WORDING'].split(',') + const prereleaseWords = ['preprelease', 'alpha', 'beta', 'rc'] + let version = 'patch' + let preid = null; + let foundWords = []; + if (messages.some( message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) { version = 'major' } else if (messages.some(message => minorWords.some(word => message.includes(word)))) { version = 'minor' - } else if (messages.some(message => message.includes('prerelease'))) { - version = 'prerelease' + } else if (messages.some(message => prereleaseWords.some(word => { + if (message.includes(word)) { + foundWords.push(word); + return true; + } else { + return false; + } + } + ))) { + version = 'prerelease'; + console.log(foundWords); } try {