dotFactory

Put a workflow on a schedule

Some work is worth doing regularly: checking for overdue tasks, reviewing open pull requests, or producing a daily report.

You could start the workflow by hand each time. With a scheduled trigger, Factory can start a Run for you instead.

New to Factory? Start with What is Factory? for an overview of workflows, triggers, and Runs.

Add a schedule

A scheduled trigger uses kind: cron and a five-field cron expression:

trigger nightly:
  kind: cron
  config: { schedule: "0 3 * * *" }
  out: {
    expression: text,
    scheduled_at: time,
    fired_at: time
  }

This trigger fires every day at 03:00 UTC. It’s a fragment to add to a factory, rather than a complete workflow: the factory also needs steps that consume the trigger’s values or otherwise do the work. If you haven’t uploaded a factory before, Your First Factory walks through the process.

The expression has five fields:

minute  hour  day-of-month  month  weekday

For example, 0 3 * * * means minute zero, hour three, every day of the month, every month, and every weekday. Factory interprets schedules in UTC.

See when it will run

Open your factory and select the scheduled trigger. The trigger page shows the schedule, the server time, the next firing, and the trigger’s Run history.

When the trigger fires, Factory admits a Run. A worker then picks up the work, and you can inspect the Run just as you would one started by a manual trigger.

Each firing includes:

  • expression — the schedule that fired.
  • scheduled_at — when the firing was due.
  • fired_at — when the trigger actually fired.

The distinction between the two times is useful if a firing is late. fired_at is the trigger’s firing time; the worker may start executing the Run later.

These values are outputs of the trigger. To see how a step can consume them, read How data moves through a Factory.

Pause and resume

You can pause a schedule from its trigger page, the factory page, or the dashboard. Runs already admitted aren’t stopped.

When you resume, Factory schedules the next occurrence after the current time. It doesn’t replay the occurrences missed while the schedule was paused.

Change the cadence without editing the factory

If you want to adjust the schedule without uploading a new version, add a configuration key:

trigger nightly:
  kind: cron
  config: {
    schedule: "0 3 * * *"
    schedule_key: "nightly.schedule"
  }
  out: {
    expression: text,
    scheduled_at: time,
    fired_at: time
  }

The expression in the definition is the default. You can set nightly.schedule in the factory’s configuration to use a different cadence—for example, 0 9 * * * for 09:00 UTC every day.

Scheduled Runs don’t act as a particular user, so use factory or organization configuration for this setting, rather than personal configuration. If the configured expression is invalid, Factory falls back to the schedule in the definition.

What happens when a firing is missed?

If the scheduler misses several scheduled times, Factory coalesces them rather than creating a separate Run for every missed tick. The recorded scheduled_at and fired_at values let you see when the firing was due and when it occurred.

A schedule is useful when you want work to keep moving without someone remembering to press a button. When you do want to start the same kind of work yourself—especially while testing or debugging—a manual trigger gives you that entry point.

For more details, including cron syntax and trigger behavior, see the trigger guide.