Skip to Content

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

TypeDescriptionUse Case
scheduleRuns on a cron scheduleRecurring checks (daily reports, hourly cost monitoring)
webhookFires on an incoming eventReact to GitHub events, deploys, or custom webhooks
pollChecks at a fixed intervalLightweight periodic monitoring

Schedule

Schedule triggers use cron expressions to run rules at specific times.

Schema

schedule-trigger.yaml
trigger: type: schedule cron: "string" # standard cron expression (5 fields)
FieldTypeRequiredDescription
typestringYesMust be schedule
cronstringYesStandard 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-9am.yaml
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

webhook-trigger.yaml
trigger: type: webhook event: "string" # event identifier source: github | generic # optional, defaults to generic
FieldTypeRequiredDescription
typestringYesMust be webhook
eventstringYesThe event name to listen for
sourcestringNogithub or generic. Defaults to generic.

GitHub Webhook Events

When source is github, the event string follows the format github.<event_type>.<action>:

EventDescription
github.pull_request.openedA new pull request is opened
github.pull_request.closedA pull request is closed or merged
github.workflow_run.completedA GitHub Actions workflow finishes
github.pushCode 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

large-pr-warning.yaml
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

poll-trigger.yaml
trigger: type: poll interval: "string" # duration: number + unit (m, h, d)
FieldTypeRequiredDescription
typestringYesMust be poll
intervalstringYesDuration string like "5m", "1h", or "1d"

Interval Format

The interval must match the pattern: a positive integer followed by a unit.

UnitMeaningExampleMinimum
mminutes5m = every 5 minutes1m
hhours1h = every hour-
ddays1d = every day-

The minimum poll interval is 1 minute (1m). Values like 0m or 30s are not valid.

Examples

poll-db-size.yaml
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."
poll-row-count.yaml
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

ScenarioRecommended Trigger
Run a report at a specific timeschedule with cron
React to a GitHub event in real-timewebhook with source github
React to external service eventswebhook with source generic
Simple periodic check without complex timingpoll with interval

Next Steps