-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Describe the bug
When I have a plugin that's async (meaning it uses callback(error, response) for sending the response and/or error, there's a Warning: Syntax warning: expected a boolean or a numeric value under if in myAutomation and the filter is resolved as truthy.
To Reproduce
Here's a reproduction repo with example PR - dorongutman/reproduce-gitstream-main#3
There are 4 plugins: two that return a true response, and two that return a false response. In each pair, one is a sync plugin and one is an async plugin.
You can see in this github actions run that the 2 async plugins triggered the above warning and that both were treated as truthy in the filter.
Expected behavior
An async plugin needs to work.
Example async plugins
// file at .cm/plugins/filters/falserAsync/index.js
module.exports = {
async: true,
filter: async (input, callback) => {
return callback(null, false);
}
};usage in a gitstream.cm file:
automations:
falserAsync:
if:
- {{ "" | falserAsync }}
run:
- action: add-label@v1
args:
label: "falser-async"
color: "b60205"
Screenshots
