Skip to content
Latchkey

How to Schedule a Nightly Build in GitHub Actions

on.schedule runs a workflow on a cron timetable, independent of any push.

Add on.schedule with a POSIX cron expression in UTC. The workflow runs on the default branch at each matching time.

Steps

  • Add schedule: under on with a cron entry.
  • Write the expression in UTC (five fields: minute hour day month weekday).
  • Optionally add workflow_dispatch so you can also run it on demand.

Workflow

.github/workflows/nightly.yml
on:
  schedule:
    - cron: '0 3 * * *'   # 03:00 UTC every day
  workflow_dispatch:
jobs:
  nightly:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm run test:full

Gotchas

  • Scheduled runs use the default branch only and can be delayed under platform load.
  • Latchkey runs scheduled jobs on cheaper managed runners and auto-retries transient failures.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →