add also a check for commits.lengths
This commit is contained in:
parent
affc39eb17
commit
23b3999033
2
index.js
2
index.js
|
@ -41,7 +41,7 @@ const pkg = getPackageJson();
|
||||||
let messages = []
|
let messages = []
|
||||||
if (checkLastCommitOnly === 'true') {
|
if (checkLastCommitOnly === 'true') {
|
||||||
console.log('Only checking the last commit...');
|
console.log('Only checking the last commit...');
|
||||||
const commit = event.commits ? event.commits[event.commits.length - 1] : null;
|
const commit = event.commits && event.commits.lengths > 0 ? event.commits[event.commits.length - 1] : null;
|
||||||
messages = commit ? [commit.message + '\n' + commit.body] : [];
|
messages = commit ? [commit.message + '\n' + commit.body] : [];
|
||||||
} else {
|
} else {
|
||||||
messages = event.commits ? event.commits.map((commit) => commit.message + '\n' + commit.body) : [];
|
messages = event.commits ? event.commits.map((commit) => commit.message + '\n' + commit.body) : [];
|
||||||
|
|
Loading…
Reference in New Issue