GitHub Actions Scheduled Runs: Scheduled workflows

github action scheduled workflow interval cron

2 min read | by Jordi Prats

GitHub Actions is a powerful automation tool that allows you to automate various tasks and processes, usually triggered by some change in the source repository. Using scheduled runs we are going to be able to schedule runs as well.

With GitHub Actions Scheduled Runs you can schedule a workflow to run at specific intervals, such as every day, every week, or every month. We can configure it using the usual cron syntax or using human readable intervals.

Cron Syntax

The cron syntax allows you to configure a more complex schedule using the same syntax you use to schedule task in Linux: yaml

on:
  schedule:
    - cron: '0 9 * * *'

jobs:
(...)

The 5 elements representing:

  1. Minute: 0-59
  2. Hour: 0-23
  3. Day of the month: 1-31
  4. Month: 1-12
  5. Day of the week: 0-7, representing both 0 and 7 Sunday

Human readable intervals

Instead of using a cron definition we can configure how often we want it to execute the workflow by defining an interval, for example, every 24 hours:

on:
  schedule:
    - interval: 24h

jobs:
(...)

Posted on 14/03/2023

Categories