Skip to content

Commit dabc11b

Browse files
committed
Fix bug when GitHub does not send some data.
1 parent 932da51 commit dabc11b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/webhooks.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ function startFromCommit(project, payload, send) {
4949
var config = pushJob(payload);
5050
var lastCommit = payload.commits[payload.commits.length - 1];
5151

52+
if (!lastCommit) {
53+
lastCommit = {};
54+
}
55+
if (!lastCommit.message) {
56+
lastCommit.message = 'No message.';
57+
}
5258
if (lastCommit.message.indexOf('[skip ci]') > -1) {
5359
return {skipCi: true};
5460
}
@@ -160,6 +166,16 @@ function pushJob(payload) {
160166
fetch: payload.ref
161167
}
162168
}
169+
if (!commit) {
170+
commit = {};
171+
}
172+
if (!commit.author) {
173+
commit.author = {
174+
name: 'No name',
175+
username: 'No login',
176+
177+
};
178+
}
163179
trigger = {
164180
type: 'commit',
165181
author: {

0 commit comments

Comments
 (0)