mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2024-11-22 08:11:07 +07:00
Rearranged output for cleaner reporting.
This commit is contained in:
parent
e514b01d25
commit
a0ae171252
10
app/main.js
10
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}`)
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user