Git & GitHub Interview Question #108
How do scheduled GitHub Actions workflows work?
Advanced GitHub Actions, Repository Internals, Submodules, LFS & Diagnostic Tools Senior Advanced
Quick Interview Answer
A workflow can use the schedule event with POSIX cron syntax to request execution at configured UTC times. Scheduled workflows are useful for maintenance, periodic tests, reports, or dependency tasks.
Detailed Explanation
A workflow can use the schedule event with POSIX cron syntax to request execution at configured UTC times. Scheduled workflows are useful for maintenance, periodic tests, reports, or dependency tasks.
Scheduled execution should not be treated as a real-time scheduler. Workflows can be delayed by platform load, and schedules should be designed with that operational behavior in mind.
Code Example
on:
schedule:
- cron: "0 2 * * *"
jobs:
nightly:
runs-on: ubuntu-latest
steps:
- run: echo "Nightly task"