This commit is contained in:
phips28 2020-11-16 20:25:09 +01:00
parent f662615664
commit f89fbceca4
1 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ Toolkit.run(async tools => {
const messages = event.commits ? event.commits.map(commit => commit.message + '\n' + commit.body) : [] const messages = event.commits ? event.commits.map(commit => commit.message + '\n' + commit.body) : []
const commitMessage = 'version bump to' const commitMessage = 'version bump to'
console.log('messages:', messages); console.log('messages:', messages)
const isVersionBump = messages.map(message => message.toLowerCase().includes(commitMessage)).includes(true) const isVersionBump = messages.map(message => message.toLowerCase().includes(commitMessage)).includes(true)
if (isVersionBump) { if (isVersionBump) {
tools.exit.success('No action necessary!') tools.exit.success('No action necessary!')
@ -32,7 +32,7 @@ Toolkit.run(async tools => {
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',') const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',')
let version = process.env['INPUT_DEFAULT'] || 'patch' let version = process.env['INPUT_DEFAULT'] || 'patch'
let foundWord = null; let foundWord = null
if (messages.some( if (messages.some(
message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) { message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) {
@ -41,15 +41,15 @@ Toolkit.run(async tools => {
version = 'minor' version = 'minor'
} else if (messages.some(message => preReleaseWords.some(word => { } else if (messages.some(message => preReleaseWords.some(word => {
if (message.includes(word)) { if (message.includes(word)) {
foundWord = word; foundWord = word
return true; return true
} else { } else {
return false; return false
} }
} }
))) { ))) {
const preid = foundWord.split("-")[1]; const preid = foundWord.split('-')[1]
version = `prerelease --preid=${preid}`; version = `prerelease --preid=${preid}`
} else if (patchWords && Array.isArray(patchWords)) { } else if (patchWords && Array.isArray(patchWords)) {
if (!messages.some(message => patchWords.some(word => message.includes(word)))) { if (!messages.some(message => patchWords.some(word => message.includes(word)))) {
version = null version = null