Skip to content

Scheduled workflows

Many times organizations need to run nightly tasks, hourly integration tests or any daily ops task. It can be achieved by adding a schedules key inside your CI pipeline code. It automatically schedules and create workflows at specified intervals.

You can schedule a workflow to run at specific times in UTC using POSIX cron syntax. Scheduled workflows run on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes.

For example, This example triggers the workflow every day at 5:30 and 17:30 UTC:

tasks:
  hello:
    steps:
    - run: Running at $(date)

trigger:
  schedules:
  - name: example
    cron: '30 5,17 * * *'
    branch: master

You can specify multiple schedules in a single workflows, which would trigger multiple distinct workflow runs/builds.

Note

  • Coordinated Universal Time (UTC) is the time zone in which schedules are interpreted.
  • We no guarantees about precision of the time. A schedule will be run as if the commit was pushed at the configured time.
  • The shortest interval you can run scheduled workflows is once every 5 minutes.
  • Schedules are deleted/updated when you commit in default branch of your repository.

Schedule Expression

cron intervals can be defined using a variant of the crontab time syntax:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
│ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
* * * * *

You can use crontab guru to help generate your cron syntax and confirm what time it will run. To help you get started, there is also a list of crontab guru examples.

Examples

Expression Interval
*/10 * * * Every 10 minutes
*/30 * * * Every 30 minutes
30 * * * * Every 30th minute of every hour
0 */4 * * * Every 4 hours
0 */12 * * * Every 12 hours