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) {
|
matches(event) {
|
||||||
const eventWithAction = [event.event, event.payload.action];
|
|
||||||
|
|
||||||
return this.events.find(e => {
|
return this.events.find(e => {
|
||||||
const parts = e.split('.');
|
const [name, action] = e.split('.');
|
||||||
for (let i = 0; i < parts.length; i++) {
|
return name === event.event && (!action || action === event.payload.action);
|
||||||
if (parts[i] !== eventWithAction[i]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}) && this.filterFn(event);
|
}) && this.filterFn(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue