Conditions
Conditions let you filter when a rule’s action should execute. After a trigger fires, the condition is evaluated against live data from a provider. The action only runs if the condition passes.
Conditions are optional. If you omit the condition block, the action fires every time the trigger activates.
Schema
condition:
provider: github | vercel | supabase
check: string # provider-specific check name
operator: string # comparison operator
value: string | number | boolean # optional, depends on operator
repo: string # optional, for GitHub provider| Field | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | The data source to check (github, vercel, or supabase) |
check | string | Yes | Provider-specific metric or value to evaluate |
operator | enum | Yes | How to compare the check result against value |
value | string, number, or boolean | No | The threshold or comparison value. Not required for operators like is_empty. |
repo | string | No | Repository in owner/name format. Required for GitHub checks. |
Operators
TinyOps provides 12 comparison operators:
| Operator | Description | Value Type | Example |
|---|---|---|---|
gt | Greater than | number | value: 3 passes if result exceeds 3 |
lt | Less than | number | value: 100 passes if result is under 100 |
eq | Equal to | string, number, boolean | value: "main" passes if result equals “main” |
gte | Greater than or equal to | number | value: 50 passes if result is 50 or more |
lte | Less than or equal to | number | value: 10 passes if result is 10 or less |
contains | Contains substring | string | value: "hotfix" passes if result contains “hotfix” |
not_contains | Does not contain substring | string | value: "WIP" passes if result does not contain “WIP” |
matches | Matches regex pattern | string (regex) | value: "^feat/" passes if result matches pattern |
none_match | No items in list match | string (regex) | value: "critical" passes if no items match |
any_match | At least one item matches | string (regex) | value: "approved" passes if any item matches |
is_empty | Value is empty or null | (none) | Passes if result is empty, null, or zero-length |
is_not_empty | Value is not empty | (none) | Passes if result has content |
The operators is_empty and is_not_empty do not require a value field. All other operators need a value for comparison.
Provider Checks
GitHub
GitHub checks require the repo field in owner/name format.
| Check | Returns | Description |
|---|---|---|
pr.age | number (days) | Age of the oldest open pull request in days |
pr.lines_changed | number | Total lines changed in the triggering PR |
repo.open_prs | number | Count of currently open pull requests |
Example: Stale PR Detection
condition:
provider: github
check: pr.age
operator: gt
value: 3
repo: acme/webappExample: Large PR Warning
condition:
provider: github
check: pr.lines_changed
operator: gt
value: 500Vercel
Vercel checks operate at the organization/account level.
| Check | Returns | Description |
|---|---|---|
billing.mtd | number (USD) | Month-to-date spend in dollars |
billing.projected | number (USD) | Projected spend for the current billing period |
Example: Cost Spike Alert
condition:
provider: vercel
check: billing.mtd
operator: gt
value: 50Example: Budget Forecast
condition:
provider: vercel
check: billing.projected
operator: gte
value: 200Supabase
Supabase checks operate on your database instance.
| Check | Returns | Description |
|---|---|---|
table.row_count | number | Number of rows in the monitored table |
db.size | number (MB) | Total database size in megabytes |
Example: Table Growth
condition:
provider: supabase
check: table.row_count
operator: gt
value: 100000Example: Database Size
condition:
provider: supabase
check: db.size
operator: gt
value: 500Operator Usage by Type
Numeric
Numeric operators compare against number values:
# Greater than
condition:
provider: vercel
check: billing.mtd
operator: gt
value: 50
# Less than or equal to
condition:
provider: supabase
check: db.size
operator: lte
value: 1000Condition Results
When a condition passes, the evaluated result is available as {{condition.result}} in your action params. This lets you include the actual value in notifications.
condition:
provider: github
check: pr.age
operator: gt
value: 3
repo: acme/webapp
action:
provider: slack
method: send_message
params:
channel: "#engineering"
text: "Oldest PR is {{condition.result}} days old."See Template Variables for all available variables.
Rules Without Conditions
If your rule should always fire when triggered, simply omit the condition block:
name: deploy-rollback
trigger:
type: webhook
event: github.workflow_run.completed
source: github
# No condition block - action fires on every trigger
action:
provider: vercel
method: rollback
params: {}Next Steps
- Actions to configure what happens when conditions pass
- Template Variables to use condition results in action params
- Triggers to configure when rules execute