All GitHub actions are handled via YAML files stored in .github/workflows directory. Every workflow consists of:
- Events = triggers that start the workflow
- Jobs = steps that execute
- Steps = individual tasks that run commands
- Actions = a command that's executed
- Runners = a GitHub Actions server
GitHub actions is completely free and available to use on any public repository and self-hosted runner. With the free plan, there is 500MB of workflows.
schedule defines when your workflow runs on. Let's take a look at this:
name: run this thing every 60 minutes on: schedule: - cron: "*/60 * * * *"
When you type this into your YAML file, a blue squiggly line will appear below
"*/60 * * * *". If you hover your mouse over this area and your cursor turns into the question mark/hook icon, you will get a pop-up with the schedule you've set. In this case it would say "Runs every hour, on the hour. Actions schedules run at most every 5 minutes."
If you want to change the schedule to your needs, the asterisks work like so:
* * * * * ┬ ┬ ┬ ┬ ┬ │ │ │ │ └─ Weekday (0=Sun .. 6=Sat) │ │ │ └────── Month (1..12) │ │ └─────────── Day (1..31) │ └──────────────── Hour (0..23) └───────────────────── Minute (0..59)
||separate individual values|
||a range of values|
||divide a value into steps|
Here are some examples that may help
||every 15 mins|
||every 2 hours|
||every week Mon-Sat at 6pm|
||every Sat and Sun on 2:10am|
||every Sunday midnight|
Each is considered an allotted time period and are based in UTC timezone. Be careful because some of you may need to do some timezone conversions!