You can trigger GitHub Actions to run on different events. Typically, you want to run an action when pushing to a repository. You may also run an action on pull requests.
When building packages for frameworks or libraries, you may want to run your code on a defined schedule. This tutorial shows you how to configure a workflow to run on a given schedule.
GitHub Actions Series Overview
Schedule GitHub Actions Using a Cron
When building a package for a framework you’re not in control of, you may want to run a scheduled GitHub Action to ensure your package works with their new releases. Even though you don’t change your code, you still want to ensure that your code works with their changes.
GitHub Actions can run on a
schedule. This schedule uses a cron notation for fine-grained configuration. Here’s a sample configuration to run an action every day at midnight:
name: Run tests on: push: pull_request: schedule: - cron: '0 0 * * *' # every day at midnight
Defining a cron schedule is challenging. The website crontab.guru translates the cron schedule into human-readable format. For example, the schedule
0 0 * * * represents “At 00:00.”.
You can find more workflow event triggers in the GitHub Actions docs.