Search code examples
githubcrongithub-actions

Does GitHub Actions support this non-standard Cron syntax?


I saw this on the crontab.guru website:

Does GitHub Actions support this syntax? That is, can I define a CI workflow like this?

name: "Do something every week"
on:
  schedule:
    - cron: "@weekly"

Solution

  • It does not work (yet) because it has an invalid syntax.

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

    ...

    Note: GitHub Actions does not support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly, and @reboot.

    GitHub documentation

    This can be quickly verified using the GitHub Actions extension on VS Code:

    enter image description here

    If you test it on GitHub your workflow will never run, even if you manually trigger it with workflow_dispatch.