listen

Listen for external events and trigger workflow runs.

Usage

raili listen                 # Polls .raili/<workflow>/trigger.js and runs workflow on events
raili listen --workflow dev  # Listen for events for the named workflow

What raili listen does

Trigger file location & contract

Place a file at .raili/<workflow>/trigger.js exporting an async function. Example:

// .raili/main/trigger.js
module.exports = async function() {
  // return null when no event, or an object with event variables
  const evt = await fetchSomeEvent();
  if (!evt) return null;
  return { ticket_id: evt.id, title: evt.title };
};

Constraints and validation:

Runtime behavior

Examples

Notes

See also: documentation/usage/run.md and documentation/usage/init.md for workflow and initialization details.