Documentation

Rules

Define rules in OSS configuration.

Rules can be defined directly in config.yaml. The syntax mirrors docs/rules.md.

Syntax

rules:
  - when: action == "opened" && pull_request.draft == false
    emit: pr.opened.ready
  - when: action == "closed" && pull_request.merged == true
    emit: pr.merged
    drivers: [amqp, http]
  - when: action == "closed" && pull_request.merged == true
    emit: [pr.merged, audit.pr.merged]
  - when: contains(labels, "bug")
    emit: issue.label.bug
  - when: like(ref, "refs/heads/%")
    emit: push.branch

JSONPath

  • Bare identifiers are treated as root JSONPath (for example, action becomes $.action).
  • Arrays are supported: $.pull_request.commits[0].created == true.

Functions

  • contains(value, needle) works for strings, arrays, and maps.
    • Example: contains(labels, "bug")
  • like(value, pattern) matches SQL-like patterns (% for any length, _ for one char).
    • Example: like(ref, "refs/heads/%")

Nested examples

rules:
  - when: contains($.pull_request.labels[*].name, "bug")
    emit: pr.label.bug

  - when: contains($.repository.full_name, "acme/")
    emit: repo.acme

  - when: like($.pull_request.head.ref, "release/%")
    emit: pr.branch.release

  - when: like($.sender.login, "bot-%")
    emit: sender.bot

Driver targeting

  • drivers omitted: publish to all configured drivers.
  • drivers specified: publish only to those drivers.

Fan-out topics

Use a list for emit to publish the same event to multiple topics.

Strict mode

Set rules_strict: true to skip a rule if any JSONPath in its when clause is missing.

System rules (GitHub App)

GitHub App installation events are always processed to keep githook_installations in sync. These updates are applied even if no user rule matches and cannot be disabled by rules:

  • installation
  • installation_repositories