forked from mirrors/probot
Simplify event filter logic
This commit is contained in:
parent
2d2b8b00f6
commit
104d59e1d6
|
@ -12,16 +12,9 @@ class WorkflowCore {
|
|||
}
|
||||
|
||||
matches(event) {
|
||||
const eventWithAction = [event.event, event.payload.action];
|
||||
|
||||
return this.events.find(e => {
|
||||
const parts = e.split('.');
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
if (parts[i] !== eventWithAction[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
const [name, action] = e.split('.');
|
||||
return name === event.event && (!action || action === event.payload.action);
|
||||
}) && this.filterFn(event);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue