Triggers
Triggers define the event that starts a rule execution. Every rule must have exactly one trigger. TinyOps supports three trigger types: schedule, webhook, and poll.
Trigger Types
| Type | Description | Use Case |
|---|---|---|
schedule | Runs on a cron schedule | Recurring checks (daily reports, hourly cost monitoring) |
webhook | Fires on an incoming event | React to GitHub events, deploys, or custom webhooks |
poll | Checks at a fixed interval | Lightweight periodic monitoring |
Schedule
Schedule triggers use cron expressions to run rules at specific times.
Schema
trigger:
type: schedule
cron: "string" # standard cron expression (5 fields)| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be schedule |
cron | string | Yes | Standard 5-field cron expression |
Cron Format
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *Examples
Weekday morning
name: stale-pr-alert
trigger:
type: schedule
cron: "0 9 * * 1-5"
condition:
provider: github
check: pr.age
operator: gt
value: 3
repo: acme/webapp
action:
provider: slack
method: send_message
params:
channel: "#engineering"
text: "Stale PRs detected (age: {{condition.result}} days)"All cron times are evaluated in UTC. Wrap cron expressions in quotes to avoid YAML parsing issues with special characters.
Webhook
Webhook triggers fire when TinyOps receives an incoming event from a connected source.
Schema
trigger:
type: webhook
event: "string" # event identifier
source: github | generic # optional, defaults to generic| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be webhook |
event | string | Yes | The event name to listen for |
source | string | No | github or generic. Defaults to generic. |
GitHub Webhook Events
When source is github, the event string follows the format github.<event_type>.<action>:
| Event | Description |
|---|---|
github.pull_request.opened | A new pull request is opened |
github.pull_request.closed | A pull request is closed or merged |
github.workflow_run.completed | A GitHub Actions workflow finishes |
github.push | Code is pushed to a branch |
Generic Webhook Events
When source is generic (or omitted), you define your own event name. TinyOps matches incoming webhook payloads by event name.
Examples
GitHub PR opened
name: large-pr-warning
trigger:
type: webhook
event: github.pull_request.opened
source: github
condition:
provider: github
check: pr.lines_changed
operator: gt
value: 500
action:
provider: github
method: pr_comment
params:
body: "This PR has {{condition.result}} lines changed. Consider breaking it into smaller PRs."Webhook rules without a condition will fire on every matching event. Add a condition if you only want to act under specific circumstances.
Poll
Poll triggers check at a fixed interval. They are simpler than cron schedules and ideal for lightweight periodic monitoring.
Schema
trigger:
type: poll
interval: "string" # duration: number + unit (m, h, d)| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be poll |
interval | string | Yes | Duration string like "5m", "1h", or "1d" |
Interval Format
The interval must match the pattern: a positive integer followed by a unit.
| Unit | Meaning | Example | Minimum |
|---|---|---|---|
m | minutes | 5m = every 5 minutes | 1m |
h | hours | 1h = every hour | - |
d | days | 1d = every day | - |
The minimum poll interval is 1 minute (1m). Values like 0m or 30s are not valid.
Examples
name: db-size-monitor
trigger:
type: poll
interval: "1h"
condition:
provider: supabase
check: db.size
operator: gt
value: 500
action:
provider: slack
method: send_message
params:
channel: "#infra"
text: "Database size is {{condition.result}}MB, exceeding 500MB threshold."name: table-growth-alert
trigger:
type: poll
interval: "30m"
condition:
provider: supabase
check: table.row_count
operator: gt
value: 100000
action:
provider: email
method: send
params:
to: "{{org.owner.email}}"
subject: "Table row count alert"
body: "Row count has reached {{condition.result}}. Time: {{now}}"Choosing a Trigger Type
| Scenario | Recommended Trigger |
|---|---|
| Run a report at a specific time | schedule with cron |
| React to a GitHub event in real-time | webhook with source github |
| React to external service events | webhook with source generic |
| Simple periodic check without complex timing | poll with interval |
Next Steps
- Conditions to filter when actions should run
- Actions for what to do when a rule fires
- YAML Syntax for full schema reference