How to Run a Job on a Schedule with a Timezone in GitHub Actions
GitHub evaluates schedule cron in UTC only, so a job meant for 9am local fires at the wrong hour unless you account for the offset.
Express the cron in UTC, and if you need a local wall-clock time, add a guard step that checks the current time in your target timezone.
Steps
- Convert your desired local time to UTC and write that into the cron.
- For DST-sensitive jobs, schedule both candidate UTC hours and guard inside the job.
- Use
TZplusdateto compute the local hour in a guard step. - Exit early when the local hour is not the intended one.
Workflow
.github/workflows/report.yml
on:
schedule:
- cron: '0 13,14 * * *' # candidate 9am America/New_York (EST/EDT)
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Only run at 09:00 New York time
run: |
HOUR=$(TZ=America/New_York date +%H)
if [ "$HOUR" != "09" ]; then
echo "Not 9am local ($HOUR); skipping."
exit 0
fi
- run: ./generate-report.shGotchas
- Scheduled runs can be delayed under load; do not rely on minute-exact timing.
- Schedules only run on the default branch.
- Latchkey runs scheduled jobs on cheaper managed runners that retry if a transient launch fails.
Related guides
How to Build Only on a Path Change in GitHub ActionsTrigger a GitHub Actions build only when files under a given path change, using push and pull_request paths f…
How to Run a Job After Another Workflow Completes in GitHub ActionsTrigger a GitHub Actions workflow after another workflow finishes using workflow_run, gating on the upstream…