From a0ae171252471c46c06267a763d3c83455738ff8 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Thu, 10 Sep 2020 21:22:51 -0500 Subject: [PATCH] Rearranged output for cleaner reporting. --- app/main.js | 10 ++++++++-- app/package.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/main.js b/app/main.js index 0e2f5fb..83f9d32 100644 --- a/app/main.js +++ b/app/main.js @@ -17,7 +17,7 @@ async function run () { // Identify the tag parsing strategy const root = core.getInput('root', { required: false }) || core.getInput('package_root', { required: false }) || './' const strategy = (core.getInput('regex_pattern', { required: false }) || '').trim().length > 0 ? 'regex' : ((core.getInput('strategy', { required: false }) || 'package').trim().toLowerCase()) - core.warning(`Attempting to use ${strategy} version extraction strategy.`) + // Extract the version number using the supplied strategy let version = core.getInput('root', { required: false }) @@ -35,7 +35,6 @@ async function run () { case 'regex': const pattern = core.getInput('regex_pattern', { required: false }) - core.warning(`Using /${pattern}/gim custom version identification pattern.`) version = (new Regex(root, new RegExp(pattern, 'gim'))).version break @@ -44,6 +43,13 @@ async function run () { return } + const msg = ` using the ${strategy} extraction${strategy === 'regex' ? ' with the /' + pattern + '/gim pattern.' : ''}.` + + if (!version) { + throw new Error(`No version identified${msg}`) + } + + core.warning(`Recognized "${version}"${msg}`) core.setOutput('version', version) core.debug(` Detected version ${version}`) diff --git a/app/package.json b/app/package.json index f2f7f7b..1fa06e5 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "autotag-action", - "version": "1.1.2", + "version": "1.1.3", "private": true, "description": "Automatically create a tag whenever the version changes in package.json", "main": "lib/main.js",