Scheduling GitHub Actions with cron

Share this video with your friends

Send Tweet

GitHub Actions can be triggered to run on a schedule using cron syntax. In this video we go over what that means and how to write cron syntax. We also show a tool and a series of examples to aid in writing and debugging cron.

  • https://crontab.guru/
Joel Hooks
Joel Hooks
~ 5 years ago

What sort of action would be most appropriate for running on a schedule like this?

Chris Biscardi
Chris Biscardi(instructor)
~ 5 years ago

Anything that you want to run on an interval that doesn't have a pre-existing event. For example, if you can run your action on push, then you shouldn't be scheduling it. Here's a couple examples of interesting schedulable actions:

  • Every hour, fetch data from remote sources and store it locally, such as a slow CMS, for a static site build
  • Every day at 10am, move all posts from draft to published that are marked to be published that day. Pushing back to the repo triggers a build-and-deploy
  • Nightly releases of your library or product. Building at 8pm every night and releasing on an alpha or nightly branch.
  • Once a week, scan activity on the repo and send an email with a digest of the merged PRs or release notes
Ahmad Awais ⚡
Ahmad Awais ⚡
~ 5 years ago

Wow, I had to provision a server only for running crons on GitHub since Actions didn't have that. And I didn't get to know when they introduced it. This will save me so much time and money. Thank you! 👌

Ahmad Awais ⚡
Ahmad Awais ⚡
~ 5 years ago

Once a week, scan activity on the repo and send an email with a digest of the merged PRs or release notes

Do you have this one handy? Would love to check it out.