Update patch version

Added fallback condition to increment patch version in cases where no commits are present in the event (e.g. Pull Requests and custom events)
This commit is contained in:
Emad-salah 2020-07-23 15:08:46 +01:00 committed by GitHub
parent 3a3a1741e8
commit 94b152067a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -12,7 +12,11 @@ Toolkit.run(async tools => {
const pkg = tools.getPackageJSON()
const event = tools.context.payload
const messages = event.commits.map(commit => commit.message + '\n' + commit.body)
if (!event.commits) {
console.log("Couldn't find any commits in this event, incrementing patch version...")
}
const messages = event.commits ? event.commits.map(commit => commit.message + '\n' + commit.body) : []
const commitMessage = 'version bump to'
const isVersionBump = messages.map(message => message.toLowerCase().includes(commitMessage)).includes(true)