C.W.K.
Stream
Lesson 13 of 14 · published

Scheduled Workflows

~9 min · schedule, cron, nightly

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Cron in YAML

on: schedule with a cron expression runs the workflow on a recurring schedule. UTC, 5-field cron, repo must have activity (no commits in 60 days = scheduled workflows pause).

Common patterns

  • Nightly full test suite — runs the long, expensive matrix every night so PRs only see the smoke subset.
  • Dependency updates — Dependabot does this for you, but you can also run npm outdated, pip-audit, etc., on a schedule.
  • Security scans — weekly CodeQL, monthly trivy.
  • Stale issue / PR reaperactions/stale.
  • Health checks — periodic curls against your prod URL with Slack alerts on failure.

Caveats

  • UTC always.
  • GitHub may delay scheduled runs at peak load — don't depend on millisecond accuracy.
  • Pair with workflow_dispatch on the same workflow so you can also run it manually for debugging.

Code

Nightly + manual·yaml
name: nightly
on:
  schedule:
    - cron: '0 6 * * *'    # daily at 06:00 UTC
  workflow_dispatch: {}

jobs:
  full-test:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4
      - run: ./run-full-suite.sh

External links

Exercise

Add a nightly workflow that runs your slow test matrix at 06:00 UTC and pair it with workflow_dispatch. Trigger it manually, watch it run; then wait one night and confirm the schedule fired.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.