Documentation

Writing Rules

Best practices for reliable routing.

Start simple and iterate with the event log.

Tips

  • Keep emit topics stable and descriptive
  • Use one rule per intent rather than huge boolean blocks
  • Test with real payloads from the event log
  • Avoid provider-specific fields unless required
  • Use event and provider for quick routing before checking deep fields

Example patterns

when: ref_type == "tag"
emit: github.tag.created
when: event == "push" && head_commit.id != "" && commits[1] == null
emit: github.commit.created
when: provider == "gitlab" && event == "merge_request" && object_attributes.action == "merge"
emit: gitlab.mr.merged